예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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));
 }
예제 #4
0
 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');
 }
예제 #5
0
파일: MenuTraitTest.php 프로젝트: d-m-/bolt
 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());
 }
예제 #6
0
 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());
 }
예제 #7
0
 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());
 }