/**
  * Check plugin admin menu file configuration.
  *
  * @return void
  */
 public function testOnSetup()
 {
     $request = new Request(['params' => ['prefix' => 'admin', 'plugin' => 'TestPlugin', 'controller' => 'Display', 'action' => 'index']]);
     $controller = new AppController($request);
     $eventHandler = new UnionEventHandler();
     $event = new Event('App.Controller.Setup', $controller);
     $controller->beforeFilter($event);
     $eventHandler->onSetup($event);
     $this->assertSame('create menu :-)', Configure::read('TestPlugin.admin_menu'));
 }
Exemple #2
0
 /**
  * Setup redirect by request data action.
  *
  * @param array $options
  * @return \Cake\Network\Response|null
  */
 public function redirect(array $options = [])
 {
     $plugin = $this->request->param('plugin');
     $controller = $this->request->param('controller');
     $_options = ['apply' => [], 'savenew' => ['plugin' => $plugin, 'controller' => $controller, 'action' => 'add'], 'save' => ['plugin' => $plugin, 'controller' => $controller, 'action' => 'index']];
     $options = Hash::merge($_options, $options);
     $url = $options['save'];
     if ($rAction = $this->request->data('action')) {
         list(, $action) = pluginSplit($rAction);
         if (isset($options[$action])) {
             $url = $options[$action];
         }
     }
     return $this->_controller->redirect($url);
 }
Exemple #3
0
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
 }
Exemple #4
0
 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
 }