@@ -487,6 +487,69 @@ public function testBakeControllerTest() {
487
487
$ this ->assertContains ("'app.articles_tag' " , $ result );
488
488
}
489
489
490
+ /**
491
+ * test baking component test files,
492
+ *
493
+ * @return void
494
+ */
495
+ public function testBakeComponentTest () {
496
+ $ this ->Task ->expects ($ this ->once ())->method ('createFile ' )->will ($ this ->returnValue (true ));
497
+
498
+ $ result = $ this ->Task ->bake ('Component ' , 'Example ' );
499
+
500
+ $ this ->assertContains ("App::uses('ExampleComponent', 'Controller/Component') " , $ result );
501
+ $ this ->assertContains ('class ExampleComponentTest extends CakeTestCase ' , $ result );
502
+
503
+ $ this ->assertContains ('function setUp() ' , $ result );
504
+ $ this ->assertContains ("\$Collection = new ComponentCollection() " , $ result );
505
+ $ this ->assertContains ("\$this->Example = new ExampleComponent( \$Collection) " , $ result );
506
+
507
+ $ this ->assertContains ('function tearDown() ' , $ result );
508
+ $ this ->assertContains ('unset($this->Example) ' , $ result );
509
+ }
510
+
511
+ /**
512
+ * test baking behavior test files,
513
+ *
514
+ * @return void
515
+ */
516
+ public function testBakeBehaviorTest () {
517
+ $ this ->Task ->expects ($ this ->once ())->method ('createFile ' )->will ($ this ->returnValue (true ));
518
+
519
+ $ result = $ this ->Task ->bake ('Behavior ' , 'Example ' );
520
+
521
+ $ this ->assertContains ("App::uses('ExampleBehavior', 'Model/Behavior') " , $ result );
522
+ $ this ->assertContains ('class ExampleBehaviorTest extends CakeTestCase ' , $ result );
523
+
524
+ $ this ->assertContains ('function setUp() ' , $ result );
525
+ $ this ->assertContains ("\$this->Example = new ExampleBehavior() " , $ result );
526
+
527
+ $ this ->assertContains ('function tearDown() ' , $ result );
528
+ $ this ->assertContains ('unset($this->Example) ' , $ result );
529
+ }
530
+
531
+ /**
532
+ * test baking helper test files,
533
+ *
534
+ * @return void
535
+ */
536
+ public function testBakeHelperTest () {
537
+ $ this ->Task ->expects ($ this ->once ())->method ('createFile ' )->will ($ this ->returnValue (true ));
538
+
539
+ $ result = $ this ->Task ->bake ('Helper ' , 'Example ' );
540
+
541
+ $ this ->assertContains ("App::uses('ExampleHelper', 'View/Helper') " , $ result );
542
+ $ this ->assertContains ('class ExampleHelperTest extends CakeTestCase ' , $ result );
543
+
544
+ $ this ->assertContains ('function setUp() ' , $ result );
545
+ $ this ->assertContains ("\$View = new View() " , $ result );
546
+ $ this ->assertContains ("\$this->Example = new ExampleHelper( \$View) " , $ result );
547
+
548
+ $ this ->assertContains ('function tearDown() ' , $ result );
549
+ $ this ->assertContains ('unset($this->Example) ' , $ result );
550
+ }
551
+
552
+
490
553
/**
491
554
* test Constructor generation ensure that constructClasses is called for controllers
492
555
*
0 commit comments