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

Added zend-expressive-authentication alpha3 support #4

Merged
merged 3 commits into from
Feb 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -21,10 +21,10 @@
"php": "^7.1",
"psr/container": "^1.0",
"psr/http-message": "^1.0.1",
"zendframework/zend-expressive-authentication": "^0.3 || ^1.0.0-dev || ^1.0"
"zendframework/zend-expressive-authentication": "^1.0.0alpha3"
},
"require-dev": {
"phpunit/phpunit": "^6.3",
"phpunit/phpunit": "^7.0.1",
"zendframework/zend-coding-standard": "~1.0.0"
},
"autoload": {
233 changes: 88 additions & 145 deletions composer.lock
25 changes: 20 additions & 5 deletions test/BasicAccessFactoryTest.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

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

class BasicAccessFactoryTest extends TestCase
{
/** @var ContainerInterface|ObjectProphecy */
private $container;

/** @var BasicAccessFactory */
private $factory;

/** @var UserRepositoryInterface|ObjectProphecy */
private $userRegister;

/** @var callback */
private $responseFactory;

protected function setUp()
{
$this->container = $this->prophesize(ContainerInterface::class);
$this->factory = new BasicAccessFactory();
$this->userRegister = $this->prophesize(UserRepositoryInterface::class);
$this->responsePrototype = $this->prophesize(ResponseInterface::class);
$this->responseFactory = function () {
return $this->prophesize(ResponseInterface::class)->reveal();
};
}

public function testInvokeWithEmptyContainer()
{
$this->expectException(InvalidConfigException::class);
$basicAccess = ($this->factory)($this->container->reveal());
($this->factory)($this->container->reveal());
}

public function testInvokeWithContainerEmptyConfig()
@@ -46,13 +61,13 @@ public function testInvokeWithContainerEmptyConfig()
->willReturn(true);
$this->container
->get(ResponseInterface::class)
->willReturn($this->responsePrototype->reveal());
->willReturn($this->responseFactory);
$this->container
->get('config')
->willReturn([]);

$this->expectException(InvalidConfigException::class);
$basicAccess = ($this->factory)($this->container->reveal());
($this->factory)($this->container->reveal());
}

public function testInvokeWithContainerAndConfig()
@@ -68,7 +83,7 @@ public function testInvokeWithContainerAndConfig()
->willReturn(true);
$this->container
->get(ResponseInterface::class)
->willReturn($this->responsePrototype->reveal());
->willReturn($this->responseFactory);
$this->container
->get('config')
->willReturn([
13 changes: 13 additions & 0 deletions test/BasicAccessTest.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Zend\Expressive\Authentication\AuthenticationInterface;
@@ -19,6 +20,18 @@

class BasicAccessTest extends TestCase
{
/** @var ServerRequestInterface|ObjectProphecy */
private $request;

/** @var UserRepositoryInterface|ObjectProphecy */
private $userRepository;

/** @var UserInterface|ObjectProphecy */
private $authenticatedUser;

/** @var ResponseInterface|ObjectProphecy */
private $responsePrototype;

protected function setUp()
{
$this->request = $this->prophesize(ServerRequestInterface::class);