public function testTestModelWithMethods() {
$this->_cleanUp();
mkdir($this->_testPath . '/create_test/models/', 0755, true);
$id = rand();
$path = "create_test/models/Post{$id}s.php";
file_put_contents("{$this->_testPath}/{$path}",
"<?php
namespace create_test\models;
class Post{$id}s {
public function someMethod() {}
}"
);
$this->request->params += array('command' => 'create', 'action' => 'test', 'args' => array(
'model', "Post{$id}s"
));
$test = new Test(array('request' => $this->request, 'classes' => $this->classes));
$test->path = $this->_testPath;
$test->run('test');
$expected = "Post{$id}sTest created in create_test\\tests\\cases\\models.\n";
$result = $test->response->output;
$this->assertEqual($expected, $result);
$expected = <<<test
namespace create_test\\tests\\cases\\models;
use create_test\\models\\Post{$id}s;
class Post{$id}sTest extends \\lithium\\test\\Unit {
public function setUp() {}
public function tearDown() {}
public function testSomeMethod() {}
}
test;
$replace = array("<?php", "?>");
$path = "create_test/tests/cases/models/Post{$id}sTest.php";
$result = str_replace($replace, '', file_get_contents("{$this->_testPath}/{$path}"));
$this->assertEqual($expected, $result);
}