示例#1
0
 public function testGetSubscribedEvents()
 {
     $ext = new NormalExtension();
     $events = $ext->getSubscribedEvents();
     $expected = [ControllerEvents::MOUNT => [['onMountRoutes', 0], ['onMountControllers', 0]]];
     $this->assertSame($expected, $events);
 }
示例#2
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);
 }
示例#3
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);
 }
示例#4
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));
 }
示例#5
0
 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());
 }