MediaWiki  1.33.0
IEUrlExtensionTest.php
Go to the documentation of this file.
1 <?php
2 
3 class IEUrlExtensionTest extends PHPUnit\Framework\TestCase {
4 
5  use MediaWikiCoversValidator;
6 
7  public function provideFindIE6Extension() {
8  return [
9  // url, expected, message
10  [ 'x.y', 'y', 'Simple extension' ],
11  [ 'x', '', 'No extension' ],
12  [ '', '', 'Empty string' ],
13  [ '?', '', 'Question mark only' ],
14  [ '.x?', 'x', 'Extension then question mark' ],
15  [ '?.x', 'x', 'Question mark then extension' ],
16  [ '.x*', '', 'Extension with invalid character' ],
17  [ '*.x', 'x', 'Invalid character followed by an extension' ],
18  [ 'a?b?.c?.d?e?f', 'c', 'Multiple question marks' ],
19  [ 'a?b?.exe?.d?.e', 'd', '.exe exception' ],
20  [ 'a?b?.exe', 'exe', '.exe exception 2' ],
21  [ 'a#b.c', '', 'Hash character preceding extension' ],
22  [ 'a?#b.c', '', 'Hash character preceding extension 2' ],
23  [ '.', '', 'Dot at end of string' ],
24  [ 'x.y.z', 'z', 'Two dots' ],
25  [ 'example.php?foo=a&bar=b', 'php', 'Script with query' ],
26  [ 'example%2Ephp?foo=a&bar=b', '', 'Script with urlencoded dot and query' ],
27  [ 'example%2Ephp?foo=a.x&bar=b.y', 'y', 'Script with urlencoded dot and query with dot' ],
28  ];
29  }
30 
35  public function testFindIE6Extension( $url, $expected, $message ) {
36  $this->assertEquals(
37  $expected,
39  $message
40  );
41  }
42 }
IEUrlExtensionTest\testFindIE6Extension
testFindIE6Extension( $url, $expected, $message)
IEUrlExtension::findIE6Extension provideFindIE6Extension.
Definition: IEUrlExtensionTest.php:35
IEUrlExtensionTest\provideFindIE6Extension
provideFindIE6Extension()
Definition: IEUrlExtensionTest.php:7
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
Definition: IEUrlExtensionTest.php:3
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