From e9ffd52cb34ba1ecd260d7663801b9e2e8b3c220 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sat, 17 Jan 2015 20:50:22 +0530 Subject: [PATCH] Add tests proving using meta('icon') with theme works as expected. --- tests/TestCase/View/Helper/HtmlHelperTest.php | 32 ++++++++++++++++++ .../Plugin/TestTheme/webroot/favicon.ico | Bin 0 -> 1782 bytes 2 files changed, 32 insertions(+) create mode 100644 tests/test_app/Plugin/TestTheme/webroot/favicon.ico diff --git a/tests/TestCase/View/Helper/HtmlHelperTest.php b/tests/TestCase/View/Helper/HtmlHelperTest.php index 5fe10cece21..a94a8730f36 100644 --- a/tests/TestCase/View/Helper/HtmlHelperTest.php +++ b/tests/TestCase/View/Helper/HtmlHelperTest.php @@ -1671,6 +1671,38 @@ public function testMetaIcon() $this->assertHtml($expected, $result); } + /** + * Test generating favicon's with meta() with theme + * + * @return void + */ + public function testMetaIconWithTheme() + { + $this->Html->Url->theme = 'TestTheme'; + + $result = $this->Html->meta('icon', 'favicon.ico'); + $expected = [ + 'link' => ['href' => 'preg:/.*test_theme\/favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'icon'], + ['link' => ['href' => 'preg:/.*test_theme\/favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'shortcut icon']] + ]; + $this->assertHtml($expected, $result); + + $result = $this->Html->meta('icon'); + $expected = [ + 'link' => ['href' => 'preg:/.*test_theme\/favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'icon'], + ['link' => ['href' => 'preg:/.*test_theme\/favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'shortcut icon']] + ]; + $this->assertHtml($expected, $result); + + $this->Html->request->webroot = '/testing/'; + $result = $this->Html->meta('icon'); + $expected = [ + 'link' => ['href' => '/testing/test_theme/favicon.ico', 'type' => 'image/x-icon', 'rel' => 'icon'], + ['link' => ['href' => '/testing/test_theme/favicon.ico', 'type' => 'image/x-icon', 'rel' => 'shortcut icon']] + ]; + $this->assertHtml($expected, $result); + } + /** * Test the inline and block options for meta() * diff --git a/tests/test_app/Plugin/TestTheme/webroot/favicon.ico b/tests/test_app/Plugin/TestTheme/webroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..aaac9c853a085a151ef0b2ded6f03ecd88f88899 GIT binary patch literal 1782 zcmZuxc{H2(8vck{YH2L3U6I6Ci{zs&X;D#QrZ*&^i{84XI(0j$xRmxXt*IrVEw@F7 z+uEv@*w=$BB$il$kZ35^Qn3tU=~#l=<}*Ea{<`P9=l8tpAMbgd-wOZ|fFuBi0}#pr z2ND2a1OR}({+F091pr7%0HAo{-4u^&9fwMa?qB1G5JD3GTowks#ug_?5R7?V@^Xc+ z*}%H~v}J{^c^3lwVjYGU$f?$|_%lYZU5qWiP`8H5XL1GKO@bkLp9V|}jig5&7zyPTS^5n9mvAcYk~WabC%ir3gh_ZWG% zD$_ms>m%x||H3BV2cxfchuo++1AeTHsj#x0=!{w{DxMom7B&QIe;8kxC>F2sJMWWr zrWTfF2X+qECkLp@CFR?DE7foA?rzPu6#t7;@raumG{FuXX-%w*Oiex7Ih=?m0cQVh zO)*WEo_=NCnmi$zX#M`TV^FQt9p~(&AvnjIJ@v#1er$?BkO)jDSULrx(?$C^T@q=l zo!QLDt-CQ_WxrCM4cC$EmO4Pbe1!kbc-DsD8)$x({B1rb3h-(#DZC?2C!4-KuJX2T zePuoL{C#EA)OvuHgOYTE`sA@hJKwvJk-LIOu}-70N3W2!84<UQ4$(~ zL;}g98v*tpK&~M;PndfMERw5v=GF2+# zJrsWuY_9aotmF4L*1Ifh=SQ1ft0~r{V#RB}WQ3?SzBCqiT*)<7t$E?VK5g;#5xPCl zVSi7Ys|kMrllmm$wnSSt-$ShL|KsB?t_xc}Yx8swg|ag>{)yK38>^e=i=X5bcO*G> zI$L&7{d>K!Jx+F&Pi>yvgjHTQqH{fjtfw>qp)SL|>CL6uDqH~(G1Nvbh%xFc0OuIw zeunvSDT^9l-a*va*_&S9XelkT{mA>d--XoKq`tZJt~pkVl_opR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