@@ -46,35 +46,54 @@ protected function getFileContents(string $filepath): string
4646 return file_get_contents ($ filepath ) ?: '' ;
4747 }
4848
49- public function testGenerateCell ()
49+ public function testGenerateCell (): void
5050 {
5151 command ('make:cell RecentCell ' );
5252
5353 // Check the class was generated
5454 $ file = APPPATH . 'Cells/RecentCell.php ' ;
55+ $ this ->assertStringContainsString ('File created: ' . clean_path ($ file ), $ this ->getStreamFilterBuffer ());
5556 $ this ->assertFileExists ($ file );
56- $ contents = $ this ->getFileContents ($ file );
57- $ this ->assertStringContainsString ('class RecentCell extends Cell ' , $ contents );
57+ $ this ->assertStringContainsString ('class RecentCell extends Cell ' , $ this ->getFileContents ($ file ));
5858
5959 // Check the view was generated
60- $ file = APPPATH . 'Cells/recent_cell .php ' ;
61- $ this ->assertStringContainsString ('File created: ' , $ this ->getStreamFilterBuffer ());
60+ $ file = APPPATH . 'Cells/recent .php ' ;
61+ $ this ->assertStringContainsString ('File created: ' . clean_path ( $ file ) , $ this ->getStreamFilterBuffer ());
6262 $ this ->assertFileExists ($ file );
63+ $ this ->assertSame ("<div> \n <!-- Your HTML here --> \n</div> \n" , $ this ->getFileContents ($ file ));
6364 }
6465
65- public function testGenerateCellSimpleName ()
66+ public function testGenerateCellSimpleName (): void
6667 {
6768 command ('make:cell Another ' );
6869
6970 // Check the class was generated
70- $ file = APPPATH . 'Cells/Another.php ' ;
71+ $ file = APPPATH . 'Cells/AnotherCell.php ' ;
72+ $ this ->assertStringContainsString ('File created: ' . clean_path ($ file ), $ this ->getStreamFilterBuffer ());
7173 $ this ->assertFileExists ($ file );
72- $ contents = $ this ->getFileContents ($ file );
73- $ this ->assertStringContainsString ('class Another extends Cell ' , $ contents );
74+ $ this ->assertStringContainsString ('class AnotherCell extends Cell ' , $ this ->getFileContents ($ file ));
7475
7576 // Check the view was generated
7677 $ file = APPPATH . 'Cells/another.php ' ;
77- $ this ->assertStringContainsString ('File created: ' , $ this ->getStreamFilterBuffer ());
78+ $ this ->assertStringContainsString ('File created: ' . clean_path ( $ file ) , $ this ->getStreamFilterBuffer ());
7879 $ this ->assertFileExists ($ file );
80+ $ this ->assertSame ("<div> \n <!-- Your HTML here --> \n</div> \n" , $ this ->getFileContents ($ file ));
81+ }
82+
83+ public function testGenerateCellWithCellInBetween (): void
84+ {
85+ command ('make:cell PippoCellular ' );
86+
87+ // Check the class was generated
88+ $ file = APPPATH . 'Cells/PippoCellularCell.php ' ;
89+ $ this ->assertStringContainsString ('File created: ' . clean_path ($ file ), $ this ->getStreamFilterBuffer ());
90+ $ this ->assertFileExists ($ file );
91+ $ this ->assertStringContainsString ('class PippoCellularCell extends Cell ' , $ this ->getFileContents ($ file ));
92+
93+ // Check the view was generated
94+ $ file = APPPATH . 'Cells/pippo_cellular.php ' ;
95+ $ this ->assertStringContainsString ('File created: ' . clean_path ($ file ), $ this ->getStreamFilterBuffer ());
96+ $ this ->assertFileExists ($ file );
97+ $ this ->assertSame ("<div> \n <!-- Your HTML here --> \n</div> \n" , $ this ->getFileContents ($ file ));
7998 }
8099}
0 commit comments