Commit 69c0d630 authored by Luke081515's avatar Luke081515
Browse files

Add test for readSection

* Added test for readSection
parent 5be84718
......@@ -3,7 +3,6 @@ require_once __DIR__ . '/../TestCore.php';
use PHPUnit\Framework\TestCase;
/**
* @covers BotCore
* Tests for all read function
*/
final class BotCoreReadTest extends TestCase {
......@@ -19,29 +18,59 @@ final class BotCoreReadTest extends TestCase {
}
return new TestCore($params);
}
/**
* @covers BotCore::readPage
*/
public function testReadPageSuccessful() {
$Core = $this->createLogin();
$expected = "#WEITERLEITUNG [[Wikipedia:Hauptseite]]";
$actually = $Core->execute(array("readPage", "Hauptseite"));
$this->assertEquals($expected, $actually);
}
/**
* @covers BotCore::readPage
*/
public function testReadPageMissing() {
$Core = $this->createLogin();
$expected = null;
$actually = $Core->execute(array("readPage", "Sfdfsdf"));
$this->assertEquals($expected, $actually);
}
/**
* @covers BotCore::readPageJs
*/
public function testReadPageJsSuccessful() {
$Core = $this->createLogin();
$expected = "UTTest";
$actually = $Core->execute(array("readPageJs", "Benutzer:Luke081515Bot/Testpage.js"));
$this->assertEquals($expected, $actually);
}
/**
* @covers BotCore::readPageCss
*/
public function testReadPageCssSuccessful() {
$Core = $this->createLogin();
$expected = "UTTest";
$actually = $Core->execute(array("readPageCss", "Benutzer:Luke081515Bot/Testpage.css"));
$this->assertEquals($expected, $actually);
}
/**
* @covers BotCore::readSection
*/
public function testReadSection0Successful() {
$Core = $this->createLogin();
$expected = "text";
$actually = $Core->execute(array("readSection", "Benutzer:Luke081515Bot/SectionTest"));
$this->assertEquals($expected, $actually);
}
/**
* @covers BotCore::readSection
*/
public function testReadSection1Successful() {
$Core = $this->createLogin();
$expected = "== Section 1 ==\ntext 2";
$actually = $Core->execute(array("readSection", "Benutzer:Luke081515Bot/SectionTest"));
$this->assertEquals($expected, $actually);
}
}
?>
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