1313 */
1414namespace DebugKit \Test \TestCase \Controller ;
1515
16- use Cake \Core \Plugin ;
1716use Cake \ORM \TableRegistry ;
18- use Cake \Routing \RouteBuilder ;
1917use Cake \Routing \Router ;
2018use Cake \TestSuite \IntegrationTestCase ;
19+ use DebugKit \TestApp \Application ;
2120
2221/**
2322 * Mail preview controller test
@@ -43,22 +42,10 @@ class MailPreviewControllerTest extends IntegrationTestCase
4342 public function setUp ()
4443 {
4544 parent ::setUp ();
46-
47- Plugin::getCollection ()->add (new \Debugkit \Plugin ());
4845 Router::scope ('/ ' , function ($ routes ) {
4946 $ routes ->connect ('/users/:action/* ' , ['controller ' => 'Users ' ]);
5047 });
51-
52- Router::plugin ('DebugKit ' , function (RouteBuilder $ routes ) {
53- $ routes ->scope (
54- '/mail_preview ' ,
55- ['controller ' => 'MailPreview ' ],
56- function ($ routes ) {
57- $ routes ->connect ('/sent/* ' , ['action ' => 'sent ' ]);
58- $ routes ->connect ('/preview/* ' , ['action ' => 'email ' ]);
59- }
60- );
61- });
48+ $ this ->configApplication (Application::class, []);
6249 $ this ->useHttpServer (true );
6350 }
6451
@@ -69,7 +56,7 @@ function ($routes) {
6956 */
7057 public function testEmailPluginPassedToView ()
7158 {
72- $ this ->get ('/debug_kit/mail_preview /preview/TestMailerPreview/test_email?plugin=DebugkitTestPlugin ' );
59+ $ this ->get ('/debug-kit/mail-preview /preview/TestMailerPreview/test_email?plugin=DebugkitTestPlugin ' );
7360
7461 $ this ->assertResponseOk ();
7562 $ this ->assertResponseContains ('src="?part=text&plugin=DebugkitTestPlugin ' );
@@ -81,7 +68,7 @@ public function testEmailPluginPassedToView()
8168 */
8269 public function testEmailPartTextContent ()
8370 {
84- $ this ->get ('/debug_kit/mail_preview /preview/TestMailerPreview/test_email?part=text&plugin=DebugkitTestPlugin ' );
71+ $ this ->get ('/debug-kit/mail-preview /preview/TestMailerPreview/test_email?part=text&plugin=DebugkitTestPlugin ' );
8572
8673 $ this ->assertResponseOk ();
8774 $ this ->assertResponseContains ('Testing email action. ' );
@@ -95,7 +82,7 @@ public function testEmailPartTextContent()
9582 */
9683 public function testOnChangeJsPluginPassedToview ()
9784 {
98- $ this ->get ('/debug_kit/mail_preview /preview/TestMailerPreview/test_email?plugin=DebugkitTestPlugin ' );
85+ $ this ->get ('/debug-kit/mail-preview /preview/TestMailerPreview/test_email?plugin=DebugkitTestPlugin ' );
9986
10087 $ this ->assertResponseContains ("iframe.contentWindow.location.replace('?part=' + part_name + '&plugin=DebugkitTestPlugin'); " );
10188 }
@@ -107,7 +94,7 @@ public function testOnChangeJsPluginPassedToview()
10794 */
10895 public function testSentInvalidData ()
10996 {
110- $ this ->get ('/debug_kit/mail_preview /sent/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/0 ' );
97+ $ this ->get ('/debug-kit/mail-preview /sent/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/0 ' );
11198 $ this ->assertResponseCode (404 );
11299 }
113100
@@ -131,7 +118,7 @@ public function testSentValidData()
131118 $ panel ->content = serialize ($ data );
132119 $ panels ->save ($ panel );
133120
134- $ this ->get ("/debug_kit/mail_preview /sent/ {$ panel ->id }/0 " );
121+ $ this ->get ("/debug-kit/mail-preview /sent/ {$ panel ->id }/0 " );
135122 $ this ->assertResponseCode (200 );
136123 $ this ->
assertResponseContains (
'[email protected] ' );
137124 $ this ->assertResponseContains ('<iframe ' );
@@ -157,7 +144,7 @@ public function testSentValidDataRenderPart()
157144 $ panel ->content = serialize ($ data );
158145 $ panels ->save ($ panel );
159146
160- $ this ->get ("/debug_kit/mail_preview /sent/ {$ panel ->id }/0?part=html " );
147+ $ this ->get ("/debug-kit/mail-preview /sent/ {$ panel ->id }/0?part=html " );
161148 $ this ->assertResponseCode (200 );
162149 $ this ->assertResponseContains ('<h1>Hi</h1> ' );
163150 }
0 commit comments