Commit 169e50c0 authored by Luke081515's avatar Luke081515 Committed by Luke081515
Browse files

Create more tests

* Added tests for readPageJs and readPageCss
* Use better formatting for tests, cerated submethod
parent a7f52913
......@@ -7,17 +7,35 @@ use PHPUnit\Framework\TestCase;
* Tests for all read function
*/
final class BotCoreReadTest extends TestCase {
public function testReadPageSuccessful() {
public $params;
public $Core;
private function createLogin() {
global $argv;
$i = 0;
for ($j = 1; isset($argv[$j]); $j++) {
$params[$i] = $argv[$j];
$i++;
}
$Core = new TestCore($params);
return new TestCore($params);
}
public function testReadPageSuccessful() {
$Core = $this->createLogin();
$expected = "#WEITERLEITUNG [[Wikipedia:Hauptseite]]";
$actually = $Core->execute(array("readPage", "Hauptseite"));
$this->assertEquals($expected, $actually);
}
public function testReadPageJsSuccessful() {
$Core = $this->createLogin();
$expected = "UTTest";
$actually = $Core->execute(array("readPageJs", "Benutzer:Luke081515Bot/Testpage.js"));
$this->assertEquals($expected, $actually);
}
public function testReadPageCssSuccessful() {
$Core = $this->createLogin();
$expected = "UTTest";
$actually = $Core->execute(array("readPageCss", "Benutzer:Luke081515Bot/Testpage.css"));
$this->assertEquals($expected, $actually);
}
}
?>
\ No newline at end of file
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment