/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void * * @since 3.5 */ protected function setUp() { parent::setUp(); $app = $this->getMockCmsApp(); JFactory::$application = $app; $router = new JComponentRouterViewInspector($app, $app->getMenu()); $router->set('name', 'content'); $categories = new JComponentRouterViewconfiguration('categories'); $categories->setKey('id'); $router->registerView($categories); $category = new JComponentRouterViewconfiguration('category'); $category->setKey('id')->setParent($categories)->setNestable()->addLayout('blog'); $router->registerView($category); $article = new JComponentRouterViewconfiguration('article'); $article->setKey('id')->setParent($category, 'catid'); $router->registerView($article); $archive = new JComponentRouterViewconfiguration('archive'); $router->registerView($archive); $featured = new JComponentRouterViewconfiguration('featured'); $router->registerView($featured); $form = new JComponentRouterViewconfiguration('form'); $router->registerView($form); $router->menu = new MockJComponentRouterRulesMenuMenuObject(); $this->object = new JComponentRouterRulesMenuInspector($router); }
/** * Search Component router constructor * * @param JApplicationCms $app The application object * @param JMenu $menu The menu object to work with */ public function __construct($app = null, $menu = null) { $params = JComponentHelper::getParams('com_contact'); $this->noIDs = (bool) $params->get('sef_ids'); $categories = new JComponentRouterViewconfiguration('categories'); $categories->setKey('id'); $this->registerView($categories); $category = new JComponentRouterViewconfiguration('category'); $category->setKey('id')->setParent($categories, 'catid')->setNestable(); $this->registerView($category); $contact = new JComponentRouterViewconfiguration('contact'); $contact->setKey('id')->setParent($category, 'catid'); $this->registerView($contact); $this->registerView(new JComponentRouterViewconfiguration('featured')); parent::__construct($app, $menu); $this->attachRule(new JComponentRouterRulesMenu($this)); $params = JComponentHelper::getParams('com_content'); if ($params->get('sef_advanced', 0)) { $this->attachRule(new JComponentRouterRulesStandard($this)); $this->attachRule(new JComponentRouterRulesNomenu($this)); } else { JLoader::register('ContactRouterRulesLegacy', __DIR__ . '/helpers/legacyrouter.php'); $this->attachRule(new ContactRouterRulesLegacy($this)); } }
/** * Test JComponentRouterViewconfiguration::removeLayout * * @return void * * @since 3.4 * @covers JComponentRouterViewconfiguration::removeLayout */ public function testRemoveLayout() { $this->assertEquals(array('default'), $this->object->layouts); $this->object->addLayout('form'); $this->assertEquals($this->object, $this->object->removeLayout('default')); $this->assertEquals(array(1 => 'form'), $this->object->layouts); $this->assertEquals($this->object, $this->object->removeLayout('fake')); $this->assertEquals(array(1 => 'form'), $this->object->layouts); $this->object->removeLayout('form'); $this->assertEquals(array(), $this->object->layouts); }
/** * Users Component router constructor * * @param JApplicationCms $app The application object * @param JMenu $menu The menu object to work with */ public function __construct($app = null, $menu = null) { $this->registerView(new JComponentRouterViewconfiguration('login')); $profile = new JComponentRouterViewconfiguration('profile'); $profile->addLayout('edit'); $this->registerView($profile); $this->registerView(new JComponentRouterViewconfiguration('registration')); $this->registerView(new JComponentRouterViewconfiguration('remind')); $this->registerView(new JComponentRouterViewconfiguration('reset')); parent::__construct($app, $menu); $this->attachRule(new JComponentRouterRulesMenu($this)); $params = JComponentHelper::getParams('com_content'); if ($params->get('sef_advanced', 0)) { $this->attachRule(new JComponentRouterRulesStandard($this)); $this->attachRule(new JComponentRouterRulesNomenu($this)); } else { JLoader::register('UsersRouterRulesLegacy', __DIR__ . '/helpers/legacyrouter.php'); $this->attachRule(new UsersRouterRulesLegacy($this)); } }
/** * As view testdata, use the view configuration of com_content * * @return array|JComponentRouterViewconfiguration */ protected function getComContentViews() { $categories = new JComponentRouterViewconfiguration('categories'); $category = new JComponentRouterViewconfiguration('category'); $category->setKey('id')->setParent($categories)->setNestable()->addLayout('blog'); $article = new JComponentRouterViewconfiguration('article'); $article->setKey('id')->setParent($category, 'catid'); $archive = new JComponentRouterViewconfiguration('archive'); $featured = new JComponentRouterViewconfiguration('featured'); $form = new JComponentRouterViewconfiguration('form'); return array('categories' => $categories, 'category' => $category, 'article' => $article, 'archive' => $archive, 'featured' => $featured, 'form' => $form); }