rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / specials / SpecialBooksourcesTest.php
blob9c71261e431299d95be1af1728c0d785eb150968
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 ],
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 ],
29 /**
30 * @covers SpecialBookSources::isValidISBN
31 * @dataProvider provideISBNs
33 public function testIsValidISBN( $isbn, $isValid ) {
34 $this->assertSame( $isValid, SpecialBookSources::isValidISBN( $isbn ) );
37 protected function newSpecialPage() {
38 return new SpecialBookSources();
41 /**
42 * @covers SpecialBookSources::execute
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 );