-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing tests, added session handling to Hello Intent, updated …
…skill configuration
- Loading branch information
Ralf Eggert
committed
Oct 8, 2017
1 parent
a07b94f
commit 1476452
Showing
11 changed files
with
416 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
module/Application/test/Config/PipelineDelegatorFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/** | ||
* PHP skeleton application for Amazon Alexa Skills | ||
* | ||
* @author Ralf Eggert <ralf@travello.audio> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/travello-gmbh/amazon-alexa-skill-skeleton | ||
* @link https://www.travello.audio/ | ||
*/ | ||
|
||
namespace ApplicationTest\Config; | ||
|
||
use Application\Config\PipelineDelegatorFactory; | ||
use Interop\Container\ContainerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\Prophecy\MethodProphecy; | ||
use Prophecy\Prophecy\ObjectProphecy; | ||
use TravelloAlexaZf\Middleware\CheckApplicationMiddleware; | ||
use TravelloAlexaZf\Middleware\ConfigureSkillMiddleware; | ||
use TravelloAlexaZf\Middleware\LogAlexaRequestMiddleware; | ||
use TravelloAlexaZf\Middleware\SetLocaleMiddleware; | ||
use TravelloAlexaZf\Middleware\ValidateCertificateMiddleware; | ||
use Zend\Expressive\Application; | ||
use Zend\Expressive\Middleware\ImplicitHeadMiddleware; | ||
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware; | ||
use Zend\Expressive\Middleware\NotFoundHandler; | ||
use Zend\Stratigility\Middleware\ErrorHandler; | ||
use Zend\Stratigility\Middleware\OriginalMessages; | ||
|
||
/** | ||
* Class PipelineDelegatorFactoryTest | ||
* | ||
* @package ApplicationTest\Config | ||
*/ | ||
class PipelineDelegatorFactoryTest extends TestCase | ||
{ | ||
/** | ||
* | ||
*/ | ||
public function testFactory() | ||
{ | ||
/** @var ContainerInterface|ObjectProphecy $container */ | ||
$container = $this->prophesize(ContainerInterface::class); | ||
|
||
/** @var Application|ObjectProphecy $application */ | ||
$application = $this->prophesize(Application::class); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(OriginalMessages::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(ErrorHandler::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipeRoutingMiddleware(); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(ConfigureSkillMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(LogAlexaRequestMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(CheckApplicationMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(ValidateCertificateMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(SetLocaleMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(ImplicitHeadMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(ImplicitOptionsMiddleware::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipeDispatchMiddleware(); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
/** @var MethodProphecy $pipeMethod */ | ||
$pipeMethod = $application->pipe(NotFoundHandler::class); | ||
$pipeMethod->shouldBeCalled(); | ||
|
||
$callable = function () use ($application) { | ||
return $application->reveal(); | ||
}; | ||
|
||
$factory = new PipelineDelegatorFactory(); | ||
|
||
$applicationReturn = $factory($container->reveal(), Application::class, $callable); | ||
|
||
$this->assertEquals($applicationReturn, $application->reveal()); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
module/Application/test/Config/RouterDelegatorFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* PHP skeleton application for Amazon Alexa Skills | ||
* | ||
* @author Ralf Eggert <ralf@travello.audio> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/travello-gmbh/amazon-alexa-skill-skeleton | ||
* @link https://www.travello.audio/ | ||
*/ | ||
|
||
/** | ||
* PHP skeleton application for Amazon Alexa Skills | ||
* | ||
* @author Ralf Eggert <ralf@travello.audio> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/travello-gmbh/amazon-alexa-skill-skeleton | ||
* @link https://www.travello.audio/ | ||
*/ | ||
|
||
namespace ApplicationTest\Config; | ||
|
||
use Application\Action\HomePageAction; | ||
use Application\Config\RouterDelegatorFactory; | ||
use Interop\Container\ContainerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\Prophecy\MethodProphecy; | ||
use Prophecy\Prophecy\ObjectProphecy; | ||
use Zend\Expressive\Application; | ||
|
||
/** | ||
* Class RouterDelegatorFactoryTest | ||
* | ||
* @package ApplicationTest\Config | ||
*/ | ||
class RouterDelegatorFactoryTest extends TestCase | ||
{ | ||
/** | ||
* | ||
*/ | ||
public function testFactory() | ||
{ | ||
/** @var ContainerInterface|ObjectProphecy $container */ | ||
$container = $this->prophesize(ContainerInterface::class); | ||
|
||
/** @var Application|ObjectProphecy $application */ | ||
$application = $this->prophesize(Application::class); | ||
|
||
/** @var MethodProphecy $getMethod */ | ||
$getMethod = $application->route('/', HomePageAction::class, ['GET', 'POST'], 'home'); | ||
$getMethod->shouldBeCalled(); | ||
|
||
$callable = function () use ($application) { | ||
return $application->reveal(); | ||
}; | ||
|
||
$factory = new RouterDelegatorFactory(); | ||
|
||
$applicationReturn = $factory($container->reveal(), Application::class, $callable); | ||
|
||
$this->assertEquals($applicationReturn, $application->reveal()); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.