@@ -462,8 +462,8 @@ public function testBakeHelperTest() {
462
462
$ this ->assertContains ('class ExampleHelperTest extends TestCase ' , $ result );
463
463
464
464
$ this ->assertContains ('function setUp() ' , $ result );
465
- $ this ->assertContains ("\$View = new View() " , $ result );
466
- $ this ->assertContains ("\$this->Example = new ExampleHelper( \$View ) " , $ result );
465
+ $ this ->assertContains ("\$view = new View() " , $ result );
466
+ $ this ->assertContains ("\$this->Example = new ExampleHelper( \$view ) " , $ result );
467
467
468
468
$ this ->assertContains ('function tearDown() ' , $ result );
469
469
$ this ->assertContains ('unset($this->Example) ' , $ result );
@@ -475,43 +475,50 @@ public function testBakeHelperTest() {
475
475
* @return void
476
476
*/
477
477
public function testGenerateConstructor () {
478
- $ result = $ this ->Task ->generateConstructor ('controller ' , 'PostsController ' , null );
478
+ $ result = $ this ->Task ->generateConstructor ('controller ' , 'PostsController ' );
479
479
$ expected = array ('' , '' , '' );
480
480
$ this ->assertEquals ($ expected , $ result );
481
481
482
- $ result = $ this ->Task ->generateConstructor ('model ' , 'Post ' , null );
483
- $ expected = array ('' , "ClassRegistry::init('Post' ); \n" , '' );
482
+ $ result = $ this ->Task ->generateConstructor ('table ' , 'App\Model \\ Table\PostsTable ' );
483
+ $ expected = array ('' , "TableRegistry::get('Posts', ['className' => 'App\Model \\ Table\PostsTable'] ); \n" , '' );
484
484
$ this ->assertEquals ($ expected , $ result );
485
485
486
- $ result = $ this ->Task ->generateConstructor ('helper ' , 'FormHelper ' , null );
487
- $ expected = array ("\$View = new View(); \n" , "new FormHelper( \$View); \n" , '' );
486
+ $ result = $ this ->Task ->generateConstructor ('helper ' , 'FormHelper ' );
487
+ $ expected = array ("\$view = new View(); \n" , "new FormHelper( \$view); \n" , '' );
488
+ $ this ->assertEquals ($ expected , $ result );
489
+
490
+ $ result = $ this ->Task ->generateConstructor ('entity ' , 'TestPlugin\Model\Entity\Article ' , null );
491
+ $ expected = array ("" , "new Article(); \n" , '' );
488
492
$ this ->assertEquals ($ expected , $ result );
489
493
}
490
494
491
495
/**
492
496
* Test generateUses()
497
+ *
498
+ * @return void
493
499
*/
494
500
public function testGenerateUses () {
495
- $ result = $ this ->Task ->generateUses ('model ' , 'Model ' , ' App\Model\Post ' );
501
+ $ result = $ this ->Task ->generateUses ('table ' , 'App\Model\Table\PostsTable ' );
496
502
$ expected = array (
497
- 'App\Model\Post ' ,
503
+ 'Cake\ORM\TableRegistry ' ,
504
+ 'App\Model\Table\PostsTable ' ,
498
505
);
499
506
$ this ->assertEquals ($ expected , $ result );
500
507
501
- $ result = $ this ->Task ->generateUses ('controller ' , 'Controller ' , ' App\Controller\PostsController ' );
508
+ $ result = $ this ->Task ->generateUses ('controller ' , 'App\Controller\PostsController ' );
502
509
$ expected = array (
503
510
'App\Controller\PostsController ' ,
504
511
);
505
512
$ this ->assertEquals ($ expected , $ result );
506
513
507
- $ result = $ this ->Task ->generateUses ('helper ' , 'View/Helper ' , ' App\View\Helper\FormHelper ' );
514
+ $ result = $ this ->Task ->generateUses ('helper ' , 'App\View\Helper\FormHelper ' );
508
515
$ expected = array (
509
516
'Cake\View\View ' ,
510
517
'App\View\Helper\FormHelper ' ,
511
518
);
512
519
$ this ->assertEquals ($ expected , $ result );
513
520
514
- $ result = $ this ->Task ->generateUses ('component ' , 'Controller/Component ' , ' App\Controller\Component\AuthComponent ' );
521
+ $ result = $ this ->Task ->generateUses ('component ' , 'App\Controller\Component\AuthComponent ' );
515
522
$ expected = array (
516
523
'Cake\Controller\ComponentRegistry ' ,
517
524
'App\Controller\Component\AuthComponent ' ,
0 commit comments