li3 create model Posts li3 create --library=li3_plugin model Posts
Inheritance: extends lithium\console\command\Create
示例#1
0
 public function testClass()
 {
     $this->request->params = array('command' => 'model', 'action' => 'Posts');
     $model = new Model(array('request' => $this->request, 'classes' => $this->classes));
     $expected = 'Posts';
     $result = $model->invokeMethod('_class', array($this->request));
     $this->assertEqual($expected, $result);
 }
    public function testRun()
    {
        $model = new Model(array('request' => $this->request, 'classes' => $this->classes));
        $model->path = $this->_testPath;
        $model->run('Post');
        $expected = "Post created in create_test\\models.\n";
        $result = $model->response->output;
        $this->assertEqual($expected, $result);
        $expected = <<<'test'


namespace create_test\models;

class Post extends \lithium\data\Model {

	public $validates = array();
}


test;
        $replace = array("<?php", "?>");
        $result = str_replace($replace, '', file_get_contents($this->_testPath . '/create_test/models/Post.php'));
        $this->assertEqual($expected, $result);
    }