Do not insert page titles into querycache.qc_value
[lhc/web/wiklou.git] / tests / phpunit / includes / specials / SpecialBooksourcesTest.php
1 <?php
2 class SpecialBooksourcesTest extends SpecialPageTestBase {
3 public static function provideISBNs() {
4 return [
5 [ '978-0-300-14424-6', true ],
6 [ '0-14-020652-3', true ],
7 [ '020652-3', false ],
8 [ '9781234567897', true ],
9 [ '1-4133-0454-0', true ],
10 [ '978-1413304541', true ],
11 [ '0136091814', true ],
12 [ '0136091812', false ],
13 [ '9780136091813', true ],
14 [ '9780136091817', false ],
15 [ '123456789X', true ],
16
17 // T69021
18 [ '1413304541', false ],
19 [ '141330454X', false ],
20 [ '1413304540', true ],
21 [ '14133X4540', false ],
22 [ '97814133X4541', false ],
23 [ '978035642615X', false ],
24 [ '9781413304541', true ],
25 [ '9780356426150', true ],
26 ];
27 }
28
29 /**
30 * @covers SpecialBookSources::isValidISBN
31 * @dataProvider provideISBNs
32 */
33 public function testIsValidISBN( $isbn, $isValid ) {
34 $this->assertSame( $isValid, SpecialBookSources::isValidISBN( $isbn ) );
35 }
36
37 protected function newSpecialPage() {
38 return new SpecialBookSources();
39 }
40
41 /**
42 * @covers SpecialBookSources::execute
43 */
44 public function testExecute() {
45 list( $html, ) = $this->executeSpecialPage( 'Invalid', null, 'qqx' );
46 $this->assertContains( '(booksources-invalid-isbn)', $html );
47 list( $html, ) = $this->executeSpecialPage( '0-7475-3269-9', null, 'qqx' );
48 $this->assertNotContains( '(booksources-invalid-isbn)', $html );
49 $this->assertContains( '(booksources-text)', $html );
50 }
51 }