Skip to content
Browse files

Merge branch 'feature/bootstrap-proem' into develop

  • Loading branch information...
2 parents 2bfb1cc + 3bd63a4 commit 945af6c984e3dfe275fa3099726ec99607c1e34f @trq trq committed
Showing with 52 additions and 8 deletions.
  1. +9 −1 lib/Proem/Proem.php
  2. +43 −7 tests/ProemTest.php
View
10 lib/Proem/Proem.php
@@ -67,7 +67,9 @@ public function __construct(AssetManagerInterface $assetManager = null)
$this->assetManager->alias([
'Proem\Signal\EventManagerInterface' => 'Proem\Signal\EventManager',
- 'Proem\Signal\EventManager' => 'eventManager'
+ 'Proem\Signal\EventManager' => 'eventManager',
+ 'Proem\Filter\ChainManagerInterface' => 'Proem\Filter\ChainManager',
+ 'Proem\Filter\ChainManager' => 'chainManager'
]);
}
@@ -84,6 +86,12 @@ public function bootstrap(EventInterface $initEvent = null)
$this->assetManager->resolve('eventManager')->trigger($initEvent);
+ $this->assetManager->resolve('chainManager')
+ ->attach($this->assetManager->resolve('Proem\Bootstrap\Request'))
+ ->attach($this->assetManager->resolve('Proem\Bootstrap\Route'))
+ ->attach($this->assetManager->resolve('Proem\Bootstrap\Dispatch'))
+ ->bootstrap();
+
return $this;
}
}
View
50 tests/ProemTest.php
@@ -33,13 +33,15 @@ class ProemTest extends \PHPUnit_Framework_TestCase
{
public function testCanInstantiateProem()
{
- $assetManager = \Mockery::mock('\Proem\Service\AssetManagerInterface');
+ $assetManager = m::mock('\Proem\Service\AssetManagerInterface');
$assetManager
->shouldReceive('alias')
->once()
->with([
'Proem\Signal\EventManagerInterface' => 'Proem\Signal\EventManager',
- 'Proem\Signal\EventManager' => 'eventManager'
+ 'Proem\Signal\EventManager' => 'eventManager',
+ 'Proem\Filter\ChainManagerInterface' => 'Proem\Filter\ChainManager',
+ 'Proem\Filter\ChainManager' => 'chainManager'
]);
$this->assertInstanceOf('Proem\Proem', new Proem($assetManager));
@@ -47,26 +49,60 @@ public function testCanInstantiateProem()
public function testLoadsDefaultEventManager()
{
+ $request = m::mock('Proem\Bootstrap\Request');
+ $route = m::mock('Proem\Bootstrap\Route');
+ $dispatch = m::mock('Proem\Bootstrap\Dispatch');
+
$eventManager = m::mock('\Proem\Signal\EventManagerInterface');
$eventManager
->shouldReceive('trigger')
->once()
->with('\Proem\Signal\EventInterface');
- $assetManager = \Mockery::mock('\Proem\Service\AssetManagerInterface');
+ $chainManager = m::mock('\Proem\Filter\ChainManagerInterface');
+ $chainManager
+ ->shouldReceive('attach')
+ ->times(3)
+ ->andReturn($chainManager)
+ ->shouldReceive('bootstrap')
+ ->once();
+
+ $assetManager = m::mock('\Proem\Service\AssetManagerInterface');
+
$assetManager
->shouldReceive('alias')
->once()
->with([
'Proem\Signal\EventManagerInterface' => 'Proem\Signal\EventManager',
- 'Proem\Signal\EventManager' => 'eventManager'
- ]);
+ 'Proem\Signal\EventManager' => 'eventManager',
+ 'Proem\Filter\ChainManagerInterface' => 'Proem\Filter\ChainManager',
+ 'Proem\Filter\ChainManager' => 'chainManager'
+ ])
- $assetManager
->shouldReceive('resolve')
->once()
->with('eventManager')
- ->andReturn($eventManager);
+ ->andReturn($eventManager)
+
+ ->shouldReceive('resolve')
+ ->once()
+ ->with('chainManager')
+ ->andReturn($chainManager)
+
+ ->shouldReceive('resolve')
+ ->once()
+ ->with('Proem\Bootstrap\Request')
+ ->andReturn($request)
+
+ ->shouldReceive('resolve')
+ ->once()
+ ->with('Proem\Bootstrap\Route')
+ ->andReturn($route)
+
+ ->shouldReceive('resolve')
+ ->once()
+ ->with('Proem\Bootstrap\Dispatch')
+ ->andReturn($dispatch);
(new Proem($assetManager))->bootstrap();
}

0 comments on commit 945af6c

Please sign in to comment.
Something went wrong with that request. Please try again.