Beispiel #1
0
 /**
  * Helper constructor.
  *
  * @param View $View
  * @param array $config
  */
 public function __construct(View $View, array $config = [])
 {
     $this->dir = Configure::read('Document.dir');
     $this->lang = Configure::read('App.locale');
     $this->eol = Configure::read('debug') ? PHP_EOL : '';
     $this->lineTab = Configure::read('debug') ? '    ' : '';
     $this->charset = Configure::read('App.encoding');
     parent::__construct($View, $config);
 }
Beispiel #2
0
 /**
  * Test render toggle element.
  *
  * @return void
  */
 public function testToggle()
 {
     $request = new Request(['params' => ['plugin' => 'TestPlugin', 'controller' => 'Pages', 'action' => 'add', 'pass' => []]]);
     $entity = new Entity();
     $view = new AppView($request);
     $union = new UnionHelper($view);
     $entity->set('id', 10);
     $entity->set('status', 0);
     $actual = $union->toggle($entity);
     $expected = ['div' => ['class' => 'un-toggle-wrapper jsToggle'], 'a' => ['href' => 'javascript:void(0);', 'class' => 'un-red un-link', 'data-url' => '/test_plugin/pages/toggle/10/0'], 'i' => ['class' => 'un-icon fa fa-circle'], '/i', '/a', '/div'];
     $this->assertHtml($expected, $actual);
     $actual = $union->toggle($entity, '/my/path/1/2');
     $expected = ['div' => ['class' => 'un-toggle-wrapper jsToggle'], 'a' => ['href' => 'javascript:void(0);', 'class' => 'un-red un-link', 'data-url' => '/my/path/1/2'], 'i' => ['class' => 'un-icon fa fa-circle'], '/i', '/a', '/div'];
     $this->assertHtml($expected, $actual);
 }