part way towards running tests from the CLI
This commit is contained in:
parent
89a0308007
commit
0fd8157e5e
2 changed files with 24 additions and 3 deletions
|
@ -110,7 +110,13 @@ class SCoreWebTestCase extends WebTestCase {
|
||||||
* the right thing; no need for http:// or any such
|
* the right thing; no need for http:// or any such
|
||||||
*/
|
*/
|
||||||
protected function get_page($page) {
|
protected function get_page($page) {
|
||||||
|
if($_SERVER['HTTP_HOST'] == "<cli command>") {
|
||||||
|
print "http://127.0.0.1/2.Xm/index.php?q=$page";
|
||||||
|
$raw = $this->get("http://127.0.0.1/2.Xm/index.php?q=$page");
|
||||||
|
}
|
||||||
|
else {
|
||||||
$raw = $this->get(make_http(make_link($page)));
|
$raw = $this->get(make_http(make_link($page)));
|
||||||
|
}
|
||||||
$this->assertNoText("Exception:");
|
$this->assertNoText("Exception:");
|
||||||
$this->assertNoText("Error:");
|
$this->assertNoText("Error:");
|
||||||
$this->assertNoText("Warning:");
|
$this->assertNoText("Warning:");
|
||||||
|
@ -217,7 +223,18 @@ class SimpleSCoreTest extends Extension {
|
||||||
$page->add_block(new NavBlock());
|
$page->add_block(new NavBlock());
|
||||||
|
|
||||||
$all = new TestFinder($event->get_arg(0));
|
$all = new TestFinder($event->get_arg(0));
|
||||||
$all->run(new SCoreReporter($page));
|
$all->run(new SCoreWebReporter($page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCommand(CommandEvent $event) {
|
||||||
|
if($event->cmd == "help") {
|
||||||
|
print " test [extension]\n";
|
||||||
|
print " run automated tests for the name extension\n\n";
|
||||||
|
}
|
||||||
|
if($event->cmd == "test") {
|
||||||
|
$all = new TestFinder($event->args[0]);
|
||||||
|
$all->run(new SCoreCLIReporter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SimpleSCoreTestTheme extends Themelet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @private */
|
/** @private */
|
||||||
class SCoreReporter extends HtmlReporter {
|
class SCoreWebReporter extends HtmlReporter {
|
||||||
var $current_html = "";
|
var $current_html = "";
|
||||||
var $clear_modules = array();
|
var $clear_modules = array();
|
||||||
var $page;
|
var $page;
|
||||||
|
@ -74,4 +74,8 @@ class SCoreReporter extends HtmlReporter {
|
||||||
$this->current_html .= "<p style='text-align: left;'><b>Exception</b>: $message";
|
$this->current_html .= "<p style='text-align: left;'><b>Exception</b>: $message";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
class SCoreCLIReporter extends TextReporter {
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Reference in a new issue