Merge "PrefixSearch: Add unit tests for StringPrefixSearch"
[lhc/web/wiklou.git] / tests / phpunit / includes / specials / SpecialBooksourcesTest.php
1 <?php
2 class SpecialBooksourcesTest extends MediaWikiTestCase {
3 public static function provideISBNs() {
4 return array(
5 array( '978-0-300-14424-6', true ),
6 array( '0-14-020652-3', true ),
7 array( '020652-3', false ),
8 array( '9781234567897', true ),
9 array( '1-4133-0454-0', true ),
10 array( '978-1413304541', true ),
11 array( '0136091814', true ),
12 array( '0136091812', false ),
13 array( '9780136091813', true ),
14 array( '9780136091817', false ),
15 array( '123456789X', true ),
16
17 // Bug 67021
18 array( '1413304541', false ),
19 array( '141330454X', false ),
20 array( '1413304540', true ),
21 array( '14133X4540', false ),
22 array( '97814133X4541', false ),
23 array( '978035642615X', false ),
24 array( '9781413304541', true ),
25 array( '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 }