Fix some tests

This commit is contained in:
ErickSkrauch
2019-08-01 19:58:18 +03:00
parent 45c2ed601d
commit 6bd054e743
7 changed files with 17 additions and 39 deletions

View File

@@ -25,7 +25,7 @@ class ComponentTest extends TestCase {
public function _before() {
parent::_before();
$this->component = new Component($this->getComponentConfig());
$this->component = new Component();
}
public function _fixtures(): array {
@@ -72,7 +72,6 @@ class ComponentTest extends TestCase {
/** @var Component|\PHPUnit\Framework\MockObject\MockObject $component */
$component = $this->getMockBuilder(Component::class)
->setMethods(['getIsGuest'])
->setConstructorArgs([$this->getComponentConfig()])
->getMock();
$component
@@ -91,7 +90,7 @@ class ComponentTest extends TestCase {
$session = $this->tester->grabFixture('sessions', 'admin2');
/** @var Component|\Mockery\MockInterface $component */
$component = mock(Component::class . '[getActiveSession]', [$this->getComponentConfig()])->makePartial();
$component = mock(Component::class . '[getActiveSession]')->makePartial();
$component->shouldReceive('getActiveSession')->times(1)->andReturn($session);
/** @var Account $account */
@@ -140,15 +139,4 @@ class ComponentTest extends TestCase {
Yii::$app->request->headers->set('Authorization', $bearerToken);
}
private function getComponentConfig() {
return [
'identityClass' => IdentityFactory::class,
'enableSession' => false,
'loginUrl' => null,
'secret' => 'secret',
'publicKeyPath' => 'data/certs/public.crt',
'privateKeyPath' => 'data/certs/private.key',
];
}
}