Permalink
Browse files

Initial work setting up to bootstrap.

  • Loading branch information...
1 parent 2bfb1cc commit 3bd63a4116885db4754aac6d9cfaa2a05d42d608 @trq trq committed Jan 31, 2013
Showing with 52 additions and 8 deletions.
  1. +9 −1 lib/Proem/Proem.php
  2. +43 −7 tests/ProemTest.php
View
@@ -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
@@ -33,40 +33,76 @@ 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));
}
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 3bd63a4

Please sign in to comment.