Skip to content

Commit

Permalink
split up tests (#4368)
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann authored Jan 20, 2024
1 parent dd1060b commit d8596f0
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 112 deletions.
14 changes: 12 additions & 2 deletions tests/phpunit/NameToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ public function testFormatMultipleAuthors9() : void { // goofy data
$authors = ',a,';
$result=format_multiple_authors($authors);
$this->assertSame('A.', $result);
}
public function testFormatMultipleAuthors10() : void {
$authors = 'a';
$result=format_multiple_authors($authors);
$this->assertSame('A.', $result);
}
public function testFormatMultipleAuthors11() : void {
$authors = ',a';
$result=format_multiple_authors($authors);
$this->assertSame('A.', $result);
}
public function testFormatMultipleAuthors12() : void {
$authors = 'a,';
$result=format_multiple_authors($authors);
$this->assertSame('A.', $result);
Expand Down Expand Up @@ -208,8 +214,10 @@ public function testFormat1() : void {
public function testFormat2() : void {
$this->assertSame('Johnson; Smith', format_surname('Johnson; Smith'));
}
public function testFormat3() : void {
public function testFormat3a() : void {
$this->assertSame('', format_author(''));
}
public function testFormat3b() : void {
$this->assertSame('', format_multiple_authors(''));
}
public function testFormat4() : void {
Expand All @@ -219,8 +227,10 @@ public function testFormat5() : void {
$this->assertSame('Johnson, A. B. C. D. E. F. G', format_author('A. B. C. D. E. F. G. Johnson'));
}

public function testCleanUpLastNames() : void {
public function testCleanUpLastNames1() : void {
$this->assertSame('B A.', clean_up_last_names('B A.'));
}
public function testCleanUpLastNames2() : void {
$this->assertSame('A.', clean_up_last_names('A.'));
}
}
12 changes: 11 additions & 1 deletion tests/phpunit/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,24 +410,34 @@ public function testNobots4() : void {
$text = '{{cite thesis|url=https://mathscinet.ams.org/mathscinet-getitem?mr=1234}}{{bots|allow=Citation Bot}}';
$page = $this->process_page($text);
$this->assertSame('{{cite thesis|url=https://mathscinet.ams.org/mathscinet-getitem?mr=1234 | mr=1234 }}{{bots|allow=Citation Bot}}', $page->parsed_text());
}
public function testNobots5() : void {
$text = '{{cite thesis|url=https://mathscinet.ams.org/mathscinet-getitem?mr=1234}}{{bots|allow=none}}';
$page = $this->process_page($text);
$this->assertSame($text, $page->parsed_text());
}
public function testNobots6() : void {
$text = '{{cite thesis|url=https://mathscinet.ams.org/mathscinet-getitem?mr=1234}}{{bots|allow=BobsCoolBot}}';
$page = $this->process_page($text);
$this->assertSame($text, $page->parsed_text());
}

public function testODNB() : void {
public function testODNB1() : void {
$text='{{Cite ODNB|title=Pierrepoint, Albert, (1905–1992)|ref=harv}} {{ODNBsub}}';
$page = $this->process_page($text);
$this->assertSame('{{Cite ODNB|title=Pierrepoint, Albert, (1905–1992)}} ', $page->parsed_text());
}
public function testODNB2() : void {
$text='{{Cite ODNB|title=Pierrepoint, Albert,_(1905–1992)}} {{ODNBsub}}';
$page = $this->process_page($text);
$this->assertSame('{{Cite ODNB|title=Pierrepoint, Albert,_(1905–1992)}} ', $page->parsed_text());
}
public function testODNB3() : void {
$text='{{Cite ODNB|title=Pierrepoint,_Albert,_(1905–1992)}} {{ODNBsub}}';
$page = $this->process_page($text);
$this->assertSame($text, $page->parsed_text()); // two underscores
}
public function testODNB4() : void {
$text='{{Cite ODNB|title=Pierrepoint, Albert, (1905–1992)}}{{Yup}}{{ODNBsub}}';
$page = $this->process_page($text);
$this->assertSame($text, $page->parsed_text()); // template in the way
Expand Down
Loading

0 comments on commit d8596f0

Please sign in to comment.