/** * Test function associated with HeadLink * * @return void * @test */ public function testHeadLinkViewFunctions() { $this->assertInstanceOf(Zbase\Models\View\HeadLink::class, zbase_view_head_link_add('style', 'style.css', 'stylesheet', 'lte IE 8', [])); $links = ['linkOne' => ['rel' => 'stylesheet', 'href' => 'styleOne.css'], 'linkTwo' => ['rel' => 'stylesheet', 'href' => 'styleTwo.css'], 'linkThree' => ['rel' => 'stylesheet', 'href' => 'styleThree.css'], 'linkFour' => ['rel' => 'stylesheet', 'href' => 'styleFour.css']]; $this->assertEquals(5, count(zbase_view_head_links_set($links))); $this->assertInstanceOf(Zbase\Models\View\HeadLink::class, zbase_view_head_link('linkThree')); $this->assertNotInstanceOf(Zbase\Models\View\HeadLink::class, zbase_view_head_link('linkFive')); $this->assertTrue(zbase_view_head_link_has('linkThree')); $this->assertFalse(zbase_view_head_link_has('linkFive')); $this->assertEquals(5, count(zbase_view_head_links($links))); }
/** * SEt the Canonical Url * @param string $canonicalUrl The Canonical URL * @param string $shortUrl The Short version of the URL * @return void */ function zbase_view_canonicalUrl($canonicalUrl, $shortUrl = null) { zbase_view_head_link_add('canonical', $canonicalUrl, 'canonical'); if (!empty($shortUrl)) { zbase_view_head_link_add('shortlink', $shortUrl, 'shortlink'); } }