Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit ed9004b

Browse files
michalbundyraweierophinney
authored andcommitted
Updated to zend-expressive-authentication alpha3
Dropped 0.X support because ResponseInterface is now used as a factory not as a response prototype
1 parent 3d7cc13 commit ed9004b

File tree

4 files changed

+67
-93
lines changed

4 files changed

+67
-93
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"php": "^7.1",
2222
"psr/container": "^1.0",
2323
"psr/http-message": "^1.0.1",
24-
"zendframework/zend-expressive-authentication": "^0.3 || ^1.0.0-dev || ^1.0"
24+
"zendframework/zend-expressive-authentication": "^1.0.0alpha3 || ^1.0"
2525
},
2626
"require-dev": {
2727
"phpunit/phpunit": "^6.3",

composer.lock

+33-87
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/BasicAccessFactoryTest.php

+20-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use PHPUnit\Framework\TestCase;
1212
use Prophecy\Argument;
13+
use Prophecy\Prophecy\ObjectProphecy;
1314
use Psr\Container\ContainerInterface;
1415
use Psr\Http\Message\ResponseInterface;
1516
use Zend\Expressive\Authentication\Basic\BasicAccess;
@@ -19,18 +20,32 @@
1920

2021
class BasicAccessFactoryTest extends TestCase
2122
{
23+
/** @var ContainerInterface|ObjectProphecy */
24+
private $container;
25+
26+
/** @var BasicAccessFactory */
27+
private $factory;
28+
29+
/** @var UserRepositoryInterface|ObjectProphecy */
30+
private $userRegister;
31+
32+
/** @var callback */
33+
private $responseFactory;
34+
2235
protected function setUp()
2336
{
2437
$this->container = $this->prophesize(ContainerInterface::class);
2538
$this->factory = new BasicAccessFactory();
2639
$this->userRegister = $this->prophesize(UserRepositoryInterface::class);
27-
$this->responsePrototype = $this->prophesize(ResponseInterface::class);
40+
$this->responseFactory = function () {
41+
return $this->prophesize(ResponseInterface::class)->reveal();
42+
};
2843
}
2944

3045
public function testInvokeWithEmptyContainer()
3146
{
3247
$this->expectException(InvalidConfigException::class);
33-
$basicAccess = ($this->factory)($this->container->reveal());
48+
($this->factory)($this->container->reveal());
3449
}
3550

3651
public function testInvokeWithContainerEmptyConfig()
@@ -46,13 +61,13 @@ public function testInvokeWithContainerEmptyConfig()
4661
->willReturn(true);
4762
$this->container
4863
->get(ResponseInterface::class)
49-
->willReturn($this->responsePrototype->reveal());
64+
->willReturn($this->responseFactory);
5065
$this->container
5166
->get('config')
5267
->willReturn([]);
5368

5469
$this->expectException(InvalidConfigException::class);
55-
$basicAccess = ($this->factory)($this->container->reveal());
70+
($this->factory)($this->container->reveal());
5671
}
5772

5873
public function testInvokeWithContainerAndConfig()
@@ -68,7 +83,7 @@ public function testInvokeWithContainerAndConfig()
6883
->willReturn(true);
6984
$this->container
7085
->get(ResponseInterface::class)
71-
->willReturn($this->responsePrototype->reveal());
86+
->willReturn($this->responseFactory);
7287
$this->container
7388
->get('config')
7489
->willReturn([

test/BasicAccessTest.php

+13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use PHPUnit\Framework\TestCase;
1212
use Prophecy\Argument;
13+
use Prophecy\Prophecy\ObjectProphecy;
1314
use Psr\Http\Message\ServerRequestInterface;
1415
use Psr\Http\Message\ResponseInterface;
1516
use Zend\Expressive\Authentication\AuthenticationInterface;
@@ -19,6 +20,18 @@
1920

2021
class BasicAccessTest extends TestCase
2122
{
23+
/** @var ServerRequestInterface|ObjectProphecy */
24+
private $request;
25+
26+
/** @var UserRepositoryInterface|ObjectProphecy */
27+
private $userRepository;
28+
29+
/** @var UserInterface|ObjectProphecy */
30+
private $authenticatedUser;
31+
32+
/** @var ResponseInterface|ObjectProphecy */
33+
private $responsePrototype;
34+
2235
protected function setUp()
2336
{
2437
$this->request = $this->prophesize(ServerRequestInterface::class);

0 commit comments

Comments
 (0)