MediaWiki  1.32.5
IEUrlExtensionTest.php
Go to the documentation of this file.
1 <?php
2 
6 class IEUrlExtensionTest extends PHPUnit\Framework\TestCase {
7 
8  use MediaWikiCoversValidator;
9 
10  public function provideFindIE6Extension() {
11  return [
12  // url, expected, message
13  [ 'x.y', 'y', 'Simple extension' ],
14  [ 'x', '', 'No extension' ],
15  [ '', '', 'Empty string' ],
16  [ '?', '', 'Question mark only' ],
17  [ '.x?', 'x', 'Extension then question mark' ],
18  [ '?.x', 'x', 'Question mark then extension' ],
19  [ '.x*', '', 'Extension with invalid character' ],
20  [ '*.x', 'x', 'Invalid character followed by an extension' ],
21  [ 'a?b?.c?.d?e?f', 'c', 'Multiple question marks' ],
22  [ 'a?b?.exe?.d?.e', 'd', '.exe exception' ],
23  [ 'a?b?.exe', 'exe', '.exe exception 2' ],
24  [ 'a#b.c', '', 'Hash character preceding extension' ],
25  [ 'a?#b.c', '', 'Hash character preceding extension 2' ],
26  [ '.', '', 'Dot at end of string' ],
27  [ 'x.y.z', 'z', 'Two dots' ],
28  [ 'example.php?foo=a&bar=b', 'php', 'Script with query' ],
29  [ 'example%2Ephp?foo=a&bar=b', '', 'Script with urlencoded dot and query' ],
30  [ 'example%2Ephp?foo=a.x&bar=b.y', 'y', 'Script with urlencoded dot and query with dot' ],
31  ];
32  }
33 
38  public function testFindIE6Extension( $url, $expected, $message ) {
39  $this->assertEquals(
40  $expected,
42  $message
43  );
44  }
45 }
IEUrlExtensionTest\testFindIE6Extension
testFindIE6Extension( $url, $expected, $message)
IEUrlExtension::findIE6Extension provideFindIE6Extension.
Definition: IEUrlExtensionTest.php:38
IEUrlExtensionTest\provideFindIE6Extension
provideFindIE6Extension()
Definition: IEUrlExtensionTest.php:10
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
IEUrlExtensionTest
Tests for IEUrlExtension::findIE6Extension.
Definition: IEUrlExtensionTest.php:6
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
IEUrlExtension\findIE6Extension
static findIE6Extension( $url)
Determine what extension IE6 will infer from a certain query string.
Definition: IEUrlExtension.php:192