Skip to content

Commit

Permalink
Merge pull request #26 from equip/feature/plates-configuration
Browse files Browse the repository at this point in the history
Add PlatesConfiguration
  • Loading branch information
elazar committed Apr 13, 2016
1 parent 17461b1 commit 9d09acf
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

_..._

## 1.7.0 - 2016-04-13

- Add `PlatesConfiguration`

## 1.6.0 - 2016-04-11

- Bump nikic/fast-route dependency version to 0.8
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Expand Up @@ -114,6 +114,7 @@ The following configurations are typically used by default:
The following configurations are available but not used by default:

* [`EnvConfiguration`](https://github.com/equip/framework/blob/master/src/Configuration/EnvConfiguration.php) - Use [Dotenv](https://github.com/josegonzalez/php-dotenv) to populate the content of [`Env`](https://github.com/equip/framework/blob/master/src/Env.php)
* [`PlatesConfiguration`](https://github.com/equip/framework/blob/master/src/Configuration/PlatesConfiguration.php) - Configure the [Plates](http://platesphp.com/) template engine
* [`PlatesResponderConfiguration`](https://github.com/equip/framework/blob/master/src/Configuration/PlatesResponderConfiguration.php) - Use [Plates](http://platesphp.com/) as the default [responder](#responders)
* [`RedisConfiguration`](https://github.com/equip/framework/blob/master/src/Configuration/RedisConfiguration.php) - Use [Redis](http://redis.io) for in-memory store

Expand Down
18 changes: 18 additions & 0 deletions src/Configuration/PlatesConfiguration.php
@@ -0,0 +1,18 @@
<?php

namespace Equip\Configuration;

use Auryn\Injector;
use League\Plates\Engine;

class PlatesConfiguration implements ConfigurationInterface
{
use EnvTrait;

public function apply(Injector $injector)
{
$injector->define(Engine::class, [
':directory' => $this->env['PLATES_DIRECTORY'],
]);
}
}
32 changes: 32 additions & 0 deletions tests/Configuration/PlatesConfigurationTest.php
@@ -0,0 +1,32 @@
<?php

namespace EquipTests\Configuration;

use Equip\Configuration\AurynConfiguration;
use Equip\Configuration\PlatesConfiguration;
use Equip\Env;
use League\Plates\Engine;

class PlatesConfigurationTest extends ConfigurationTestCase
{
protected function getConfigurations()
{
if (!class_exists(Engine::class)) {
$this->markTestSkipped('Plates is not installed');
}

$env = new Env([
'PLATES_DIRECTORY' => sys_get_temp_dir(),
]);

return [
new PlatesConfiguration($env),
];
}

public function testApply()
{
$engine = $this->injector->make(Engine::class);
$this->assertInstanceOf(Engine::class, $engine);
}
}

0 comments on commit 9d09acf

Please sign in to comment.