public function testGetInitialConfigHash()
 {
     $config = ['foo' => 'bar', 'bat' => 'baz'];
     $hash = md5(serialize($config));
     $systemConfig = new SystemConfig($config);
     $this->assertSame($hash, $systemConfig->getInitialConfigHash());
 }
 public function testConfigureNamespace()
 {
     $systemConfig = new SystemConfig();
     $configHash = $systemConfig->getInitialConfigHash();
     $listener = $this->getMock(ConfigureCacheListener::CLASS, ['getCache']);
     $listener->setConfig($systemConfig);
     $cache = $this->getMock(FileCache::CLASS);
     $listener->expects($this->once())->method('getCache')->will($this->returnValue($cache));
     $cache->expects($this->once())->method('get')->with($this->identicalTo('hash'))->will($this->returnValue('foo'));
     $cache->expects($this->once())->method('clearNamespace');
     $cache->expects($this->once())->method('set')->with($this->identicalTo('hash'), $this->identicalTo($configHash));
     $listener->configureNamespace(new SystemEvent());
 }
 public function testInvokeRaiseExceptionIfControllerOfRouteIsNotSpecified()
 {
     $systemConfig = ['router' => ['routes' => ['foo' => ['path' => '/']]]];
     $config = new SystemConfig();
     $config->merge($systemConfig);
     $router = $this->getMock(Router::CLASS);
     $cache = $this->getMock(FileCache::CLASS);
     $listener = $this->getMock(ConfigureRouterListener::CLASS, ['getCache']);
     $listener->setConfig($config);
     $listener->setRouter($router);
     $listener->expects($this->once())->method('getCache')->will($this->returnValue($cache));
     $this->setExpectedException('InvalidArgumentException');
     $listener(new ModulesEvent());
 }