public function testControllerMountDefault() { $app = $this->getApp(); $event = $this->getMock('Bolt\\Events\\MountEvent', ['mount'], [$app, $app['controllers']]); $event->expects($this->exactly(0))->method('mount'); $ext = new NormalExtension(); $ext->setContainer($app); $ext->onMountControllers($event); }
public function testRoutesDefault() { $app = $this->getApp(); $event = $this->getMockMountEvent(); $event->expects($this->exactly(2))->method('mount'); $ext = new NormalExtension(); $ext->setContainer($app); $ext->onMountRoutes($event); }
public function testDefaultConfigNoOverride() { $app = $this->getApp(); $ext = new NormalExtension(); $ext->setContainer($app); $refObj = new \ReflectionObject($ext); $method = $refObj->getMethod('getDefaultConfig'); $method->setAccessible(true); $this->assertSame([], $method->invoke($ext)); }
public function testSubscribe() { $app = $this->getApp(); $ext = new NormalExtension(); $ext->setContainer($app); $ext->boot($app); $listeners = $app['dispatcher']->getListeners('dropbear.sighting'); $this->assertInstanceOf('Bolt\\Tests\\Extension\\Mock\\NormalExtension', $listeners[0][0]); $this->setExpectedException('RuntimeException', 'Drop Bear Alert!'); $app['dispatcher']->dispatch('dropbear.sighting'); }
public function testEmptyMenus() { $app = $this->getApp(); $ext = new NormalExtension(); $ext->setContainer($app); $ext->register($app); /** @var MenuEntry $extendMenu */ $extendMenu = $app['menu.admin']->get('extend'); $this->assertSame('extend', $extendMenu->getName()); $this->assertSame('Extensions', $extendMenu->getLabel()); $this->assertSame([], $extendMenu->children()); }
public function testRegisterAssetsNoOverride() { $app = $this->getApp(); $this->assertSame(['javascript' => [], 'stylesheet' => []], $app['asset.queue.file']->getQueue()); $this->assertSame([], $app['asset.queue.snippet']->getQueue()); $this->assertSame([], $app['asset.queue.widget']->getQueue()); $ext = new NormalExtension(); $ext->setContainer($app); $ext->register($app); $this->assertSame(['javascript' => [], 'stylesheet' => []], $app['asset.queue.file']->getQueue()); $this->assertSame([], $app['asset.queue.snippet']->getQueue()); $this->assertSame([], $app['asset.queue.widget']->getQueue()); }
public function testEmptyMenus() { $app = $this->getApp(); $ext = new NormalExtension(); $baseDir = $app['filesystem']->getDir('extensions://'); $baseDir->setPath('local/bolt/menu'); $ext->setBaseDirectory($baseDir); $ext->setContainer($app); $ext->register($app); /** @var MenuEntry $extendMenu */ $extendMenu = $app['menu.admin']->get('extend'); $this->assertSame('extend', $extendMenu->getName()); $this->assertSame('Extend', $extendMenu->getLabel()); $this->assertSame([], $extendMenu->children()); }