lithium\tests\cases\console\command\create\TestTest::testTestModelWithMethods PHP Метод

testTestModelWithMethods() публичный Метод

    public function testTestModelWithMethods()
    {
        $this->_cleanUp();
        mkdir($this->_testPath . '/create_test/models/', 0755, true);
        $id = rand();
        $path = "create_test/models/Post{$id}s.php";
        $body = <<<EOD
<?php
namespace create_test\\models;

class Post{$id}s {
\tpublic function someMethod() {}
}
EOD;
        file_put_contents("{$this->_testPath}/{$path}", $body);
        $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 tests/cases/models/Post{$id}sTest.php.\n";
        $result = $test->response->output;
        $this->assertEqual($expected, $result);
        $expected = <<<EOD


namespace create_test\\tests\\cases\\models;

use create_test\\models\\Post{$id}s;

class Post{$id}sTest extends \\lithium\\test\\Unit {

\tpublic function setUp() {}

\tpublic function tearDown() {}

\tpublic function testSomeMethod() {}
}


EOD;
        $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);
    }