Skip to content

Commit 1614a75

Browse files
committed
tests: fix
1 parent 86d28a3 commit 1614a75

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tests/TestCase/Controller/AppControllerTest.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ protected function getAuthenticationServiceMock(): AuthenticationServiceInterfac
142142
/**
143143
* test `initialize` function
144144
*
145-
* @covers ::initialize()
146145
* @return void
146+
* @covers ::initialize()
147147
*/
148148
public function testInitialize(): void
149149
{
150-
$this->setupControllerAndLogin();
150+
$this->setupController();
151151

152152
static::assertNotEmpty($this->AppController->{'RequestHandler'});
153153
static::assertNotEmpty($this->AppController->{'Flash'});
@@ -181,21 +181,20 @@ public function testBeforeFilterLoginError(): void
181181
}
182182

183183
/**
184-
* test 'beforeFilter' for correct apiClient token setup
184+
* test 'initialize' and 'beforeFilter' for correct apiClient token setup
185185
*
186-
* @covers ::beforeFilter()
187186
* @return void
187+
* @covers ::beforeFilter()
188+
* @covers ::initialize()
188189
*/
189-
public function testBeforeFilterCorrectTokens(): void
190+
public function testCorrectTokens(): void
190191
{
191192
$expectedtokens = [];
192-
193193
$this->setupControllerAndLogin();
194-
195194
/** @var \Authentication\Identity|null $user */
196195
$user = $this->AppController->Authentication->getIdentity();
197196
$expectedtokens = $user->get('tokens');
198-
$this->AppController->dispatchEvent('Controller.initialize');
197+
$this->AppController->initialize();
199198
$apiClient = $this->accessProperty($this->AppController, 'apiClient');
200199
$apiClientTokens = $apiClient->getTokens();
201200

0 commit comments

Comments
 (0)