mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding test case for bake output.
This commit is contained in:
parent
08394629c9
commit
c0f06be65e
1 changed files with 26 additions and 0 deletions
|
@ -199,5 +199,31 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->expectAt(5, 'out', array("Uses:\n\tComment, User"));
|
||||
$this->Task->confirmController($controller, $scaffold, $uses, $helpers, $components);
|
||||
}
|
||||
|
||||
/**
|
||||
* test the bake method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testBake() {
|
||||
$helpers = array('Ajax', 'Time');
|
||||
$components = array('Acl', 'Auth');
|
||||
$uses = array('Comment', 'User');
|
||||
$this->Task->setReturnValue('createFile', true);
|
||||
|
||||
$result = $this->Task->bake('Articles', '--actions--', $helpers, $components, $uses);
|
||||
$this->assertPattern('/class ArticlesController extends AppController/', $result);
|
||||
$this->assertPattern('/\$components \= array\(\'Acl\', \'Auth\'\)/', $result);
|
||||
$this->assertPattern('/\$uses \= array\(\'Article\', \'Comment\', \'User\'\)/', $result);
|
||||
$this->assertPattern('/\$helpers \= array\(\'Html\', \'Form\', \'Ajax\', \'Time\'\)/', $result);
|
||||
$this->assertPattern('/\-\-actions\-\-/', $result);
|
||||
|
||||
$result = $this->Task->bake('Articles', 'scaffold', $helpers, $components, $uses);
|
||||
$this->assertPattern('/class ArticlesController extends AppController/', $result);
|
||||
$this->assertPattern('/var \$scaffold/', $result);
|
||||
$this->assertNoPattern('/helpers/', $result);
|
||||
$this->assertNoPattern('/components/', $result);
|
||||
$this->assertNoPattern('/uses/', $result);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue