33
44namespace App \Test \TestCase \Controller ;
55
6+ use Cake \Core \Configure ;
67use Cake \TestSuite \IntegrationTestTrait ;
78use Cake \TestSuite \TestCase ;
89
@@ -25,57 +26,47 @@ class PackagesControllerTest extends TestCase
2526 ];
2627
2728 /**
28- * Test index method
29- *
3029 * @return void
31- * @link \App\Controller\PackagesController::index()
3230 */
33- public function testIndex (): void
31+ protected function setUp (): void
3432 {
35- $ this ->markTestIncomplete ('Not implemented yet. ' );
33+ parent ::setUp ();
34+ Configure::write ('Packages.featured ' , ['markstory/asset_compress ' ]);
3635 }
3736
3837 /**
39- * Test view method
40- *
4138 * @return void
42- * @link \App\Controller\PackagesController::view()
4339 */
44- public function testView (): void
40+ public function testIndexShowsFeaturedSliderOnFirstPageWithoutFilters (): void
4541 {
46- $ this ->markTestIncomplete ('Not implemented yet. ' );
47- }
42+ $ this ->get ('/?sort=downloads&direction=desc ' );
4843
49- /**
50- * Test add method
51- *
52- * @return void
53- * @link \App\Controller\PackagesController::add()
54- */
55- public function testAdd (): void
56- {
57- $ this ->markTestIncomplete ('Not implemented yet. ' );
44+ $ this ->assertResponseOk ();
45+ $ this ->assertResponseContains ('Featured ' );
46+ $ this ->assertResponseContains ('data-featured-packages-slider ' );
5847 }
5948
6049 /**
61- * Test edit method
62- *
6350 * @return void
64- * @link \App\Controller\PackagesController::edit()
6551 */
66- public function testEdit (): void
52+ public function testIndexHidesFeaturedSliderOnSubsequentPages (): void
6753 {
68- $ this ->markTestIncomplete ('Not implemented yet. ' );
54+ $ this ->get ('/?sort=downloads&direction=desc&page=2 ' );
55+
56+ $ this ->assertResponseOk ();
57+ $ this ->assertResponseNotContains ('data-featured-packages-slider ' );
58+ $ this ->assertResponseNotContains ('Previous featured package ' );
6959 }
7060
7161 /**
72- * Test delete method
73- *
7462 * @return void
75- * @link \App\Controller\PackagesController::delete()
7663 */
77- public function testDelete (): void
64+ public function testIndexHidesFeaturedSliderWhenSearching (): void
7865 {
79- $ this ->markTestIncomplete ('Not implemented yet. ' );
66+ $ this ->get ('/?sort=downloads&direction=desc&search=package-02 ' );
67+
68+ $ this ->assertResponseOk ();
69+ $ this ->assertResponseNotContains ('data-featured-packages-slider ' );
70+ $ this ->assertResponseContains ('vendor/package-02 ' );
8071 }
8172}
0 commit comments