Skip to content

Commit

Permalink
Merge branch 'hotfix/template-renderer'
Browse files Browse the repository at this point in the history
Close #3
  • Loading branch information
weierophinney committed Oct 10, 2015
2 parents 579d046 + 4ac1538 commit 97adc2f
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 19 deletions.
23 changes: 22 additions & 1 deletion changelog.md → CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 0.4.0 - TBD
## 0.5.0 - 2015-10-10

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#3](https://github.com/zendframework/zend-expressive-skeleton/pull/3) updates
the skeleton to use zendframework/zend-expressive 0.4.0.

## 0.4.0 - 2015-10-09

First release as zend-expressive-skeleton.

### Added

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"roave/security-advisories": "dev-master",
"zendframework/zend-expressive": "^0.3"
"zendframework/zend-expressive": "^0.4"
},
"require-dev": {
"composer/composer": ">=1.0.0-alpha10",
Expand Down
8 changes: 4 additions & 4 deletions src/Action/HomePageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HomePageAction

private $template;

public function __construct(Router\RouterInterface $router, Template\TemplateInterface $template = null)
public function __construct(Router\RouterInterface $router, Template\TemplateRendererInterface $template = null)
{
$this->router = $router;
$this->template = $template;
Expand All @@ -36,13 +36,13 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res
$data['routerDocs'] = 'http://framework.zend.com/manual/current/en/modules/zend.mvc.routing.html';
}

if ($this->template instanceof Template\Plates) {
if ($this->template instanceof Template\PlatesRenderer) {
$data['templateName'] = 'Plates';
$data['templateDocs'] = 'http://platesphp.com/';
} elseif ($this->template instanceof Template\Twig) {
} elseif ($this->template instanceof Template\TwigRenderer) {
$data['templateName'] = 'Twig';
$data['templateDocs'] = 'http://twig.sensiolabs.org/documentation';
} elseif ($this->template instanceof Template\ZendView) {
} elseif ($this->template instanceof Template\ZendViewRenderer) {
$data['templateName'] = 'Zend View';
$data['templateDocs'] = 'http://framework.zend.com/manual/current/en/modules/zend.view.quick-start.html';
}
Expand Down
6 changes: 4 additions & 2 deletions src/Action/HomePageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

use Interop\Container\ContainerInterface;
use Zend\Expressive\Router\RouterInterface;
use Zend\Expressive\Template\TemplateInterface;
use Zend\Expressive\Template\TemplateRendererInterface;

class HomePageFactory
{
public function __invoke(ContainerInterface $container)
{
$router = $container->get(RouterInterface::class);
$template = ($container->has(TemplateInterface::class)) ? $container->get(TemplateInterface::class) : null;
$template = ($container->has(TemplateRendererInterface::class))
? $container->get(TemplateRendererInterface::class)
: null;

return new HomePageAction($router, $template);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Composer/Resources/config/templates-plates.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
'Zend\Expressive\FinalHandler' =>
Zend\Expressive\Container\TemplatedErrorHandlerFactory::class,

Zend\Expressive\Template\TemplateInterface::class =>
Zend\Expressive\Container\Template\PlatesFactory::class,
Zend\Expressive\Template\TemplateRendererInterface::class =>
Zend\Expressive\Container\Template\PlatesRendererFactory::class,
],
],

Expand Down
4 changes: 2 additions & 2 deletions src/Composer/Resources/config/templates-twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
'Zend\Expressive\FinalHandler' =>
Zend\Expressive\Container\TemplatedErrorHandlerFactory::class,

Zend\Expressive\Template\TemplateInterface::class =>
Zend\Expressive\Container\Template\TwigFactory::class,
Zend\Expressive\Template\TemplateRendererInterface::class =>
Zend\Expressive\Container\Template\TwigRendererFactory::class,
],
],

Expand Down
4 changes: 2 additions & 2 deletions src/Composer/Resources/config/templates-zend-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
'Zend\Expressive\FinalHandler' =>
Zend\Expressive\Container\TemplatedErrorHandlerFactory::class,

Zend\Expressive\Template\TemplateInterface::class =>
Zend\Expressive\Container\Template\ZendViewFactory::class,
Zend\Expressive\Template\TemplateRendererInterface::class =>
Zend\Expressive\Container\Template\ZendViewRendererFactory::class,
],
],

Expand Down
2 changes: 1 addition & 1 deletion src/Composer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'questions' => [
'router' => [
'question' => 'Which router you want to use?',
'default' => 1,
'default' => 2,
// TRUE: Must choose one / FALSE: May choose one or none of the above
'required' => true,
// Enable custom package input
Expand Down
10 changes: 6 additions & 4 deletions test/Action/HomePageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use App\Action\HomePageFactory;
use Interop\Container\ContainerInterface;
use Zend\Expressive\Router\RouterInterface;
use Zend\Expressive\Template\TemplateInterface;
use Zend\Expressive\Template\TemplateRendererInterface;

class HomePageFactoryTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -24,7 +24,7 @@ public function setUp()
public function testFactoryWithoutTemplate()
{
$factory = new HomePageFactory();
$this->container->has(TemplateInterface::class)->willReturn(false);
$this->container->has(TemplateRendererInterface::class)->willReturn(false);

$this->assertTrue($factory instanceof HomePageFactory);

Expand All @@ -36,8 +36,10 @@ public function testFactoryWithoutTemplate()
public function testFactoryWithTemplate()
{
$factory = new HomePageFactory();
$this->container->has(TemplateInterface::class)->willReturn(true);
$this->container->get(TemplateInterface::class)->willReturn($this->prophesize(TemplateInterface::class));
$this->container->has(TemplateRendererInterface::class)->willReturn(true);
$this->container
->get(TemplateRendererInterface::class)
->willReturn($this->prophesize(TemplateRendererInterface::class));

$this->assertTrue($factory instanceof HomePageFactory);

Expand Down

0 comments on commit 97adc2f

Please sign in to comment.