MediaWiki REL1_31
SpecialBooksourcesTest.php
Go to the documentation of this file.
1<?php
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
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
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}
Special page outputs information on sourcing a book with a particular ISBN The parser creates links t...
static isValidISBN( $isbn)
Return whether a given ISBN (10 or 13) is valid.
testIsValidISBN( $isbn, $isValid)
SpecialBookSources::isValidISBN provideISBNs.
newSpecialPage()
Returns a new instance of the special page under test.
testExecute()
SpecialBookSources::execute.
Base class for testing special pages.
executeSpecialPage( $subPage='', WebRequest $request=null, $language=null, User $user=null)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition hooks.txt:2006
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition hooks.txt:2013
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187