Exemple #1
0
 /**
  * Constructor.
  * @param Extender $extender
  * @param Application $app
  */
 public function __construct(Extender $extender, Application $app)
 {
     $this->checkDependencies();
     $this->extender = $extender;
     $this->app = $app;
     $this->navigation = ButtonGroup::create()->classes('navigation-list')->element('ul');
 }
 public function test_button_components()
 {
     // Test object
     $page = Page::find(1);
     // Check the create method.
     $group = ButtonGroup::create();
     $this->assertInstanceOf(ButtonGroup::class, $group);
     // Shouldn't have anything in it.
     $this->assertCount(0, $group->getButtons());
     // Should return a zero count.
     $this->assertEquals(0, $group->count());
     // Button groups
     $button = Button::create();
     // Check default setting.
     $this->assertNull($button->getAttribute('href'));
     // Adding to the group will increment the button count.
     $group->add($button);
     $this->assertEquals(1, $group->count());
     // Try adding the other way around.
     $button2 = Button::create();
     $button2->addTo($group);
     $this->assertEquals(2, $group->count());
     // Check if the button attributes are assigned correctly.
     $button->parent($page)->link('view');
     $this->assertEquals("View Pages", $button->getLabel());
     $this->assertEquals($page::getIcon(), $button->getIcon());
     $this->assertEquals(cms_url($page::plural()), $button->getAttribute('href'));
 }
 /**
  * RelatedMedia constructor.
  * @param Model $model
  */
 public function __construct(Model $model, $args = null)
 {
     parent::__construct();
     $this->actions = ButtonGroup::create();
     $this->parent($model);
     if ($args) {
         $this->child($args[0]);
     }
 }