浏览代码

Fix cake2.7 stuff

Mark Scherer 10 年之前
父节点
当前提交
59597176b2

+ 14 - 14
Test/Case/View/Helper/CommonHelperTest.php

@@ -54,7 +54,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaName() {
 		$result = $this->Common->metaName('foo', [1, 2, 3]);
-		$expected = '<meta name="foo" content="1, 2, 3" />';
+		$expected = '<meta name="foo" content="1, 2, 3"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -65,7 +65,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaDescription() {
 		$result = $this->Common->metaDescription('foo', 'deu');
-		$expected = '<meta lang="deu" name="description" content="foo" />';
+		$expected = '<meta lang="deu" name="description" content="foo"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -76,7 +76,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaKeywords() {
 		$result = $this->Common->metaKeywords('foo bar', 'deu');
-		$expected = '<meta lang="deu" name="keywords" content="foo bar" />';
+		$expected = '<meta lang="deu" name="keywords" content="foo bar"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -87,7 +87,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaRss() {
 		$result = $this->Common->metaRss('/some/url', 'some title');
-		$expected = '<link rel="alternate" type="application/rss+xml" title="some title" href="/some/url" />';
+		$expected = '<link rel="alternate" type="application/rss+xml" title="some title" href="/some/url"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -98,7 +98,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaEquiv() {
 		$result = $this->Common->metaEquiv('type', 'value');
-		$expected = '<meta http-equiv="type" content="value" />';
+		$expected = '<meta http-equiv="type" content="value"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -117,10 +117,10 @@ class CommonHelperTest extends MyCakeTestCase {
 	 */
 	public function testMetaCanonical() {
 		$is = $this->Common->metaCanonical('/some/url/param1');
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1') . '" rel="canonical" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1') . '" rel="canonical"/>', trim($is));
 
 		$is = $this->Common->metaCanonical('/some/url/param1', true);
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1', true) . '" rel="canonical" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1', true) . '" rel="canonical"/>', trim($is));
 	}
 
 	/**
@@ -129,22 +129,22 @@ class CommonHelperTest extends MyCakeTestCase {
 	public function testMetaAlternate() {
 		$is = $this->Common->metaAlternate('/some/url/param1', 'de-de', true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1', true) . '" rel="alternate" hreflang="de-de" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url/param1', true) . '" rel="alternate" hreflang="de-de"/>', trim($is));
 
 		$is = $this->Common->metaAlternate(['controller' => 'some', 'action' => 'url'], 'de', true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de"/>', trim($is));
 
 		$is = $this->Common->metaAlternate(['controller' => 'some', 'action' => 'url'], ['de', 'de-ch'], true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de" />' . PHP_EOL . '<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-ch" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de"/>' . PHP_EOL . '<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-ch"/>', trim($is));
 
 		$is = $this->Common->metaAlternate(['controller' => 'some', 'action' => 'url'], ['de' => ['ch', 'at'], 'en' => ['gb', 'us']], true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-ch" />' . PHP_EOL .
-			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-at" />' . PHP_EOL .
-			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="en-gb" />' . PHP_EOL .
-			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="en-us" />', trim($is));
+		$this->assertEquals('<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-ch"/>' . PHP_EOL .
+			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="de-at"/>' . PHP_EOL .
+			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="en-gb"/>' . PHP_EOL .
+			'<link href="' . $this->Html->url('/some/url', true) . '" rel="alternate" hreflang="en-us"/>', trim($is));
 	}
 
 	/**

+ 3 - 3
Test/Case/View/Helper/FormatHelperTest.php

@@ -61,7 +61,7 @@ class FormatHelperTest extends MyCakeTestCase {
 	 */
 	public function testIcon() {
 		$result = $this->Format->icon('edit');
-		$expected = '<img src="/img/icons/edit.gif" title="' . __d('tools', 'Edit') . '" alt="[' . __d('tools', 'Edit') . ']" class="icon" />';
+		$expected = '<img src="/img/icons/edit.gif" title="' . __d('tools', 'Edit') . '" alt="[' . __d('tools', 'Edit') . ']" class="icon"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -72,7 +72,7 @@ class FormatHelperTest extends MyCakeTestCase {
 	 */
 	public function testCIcon() {
 		$result = $this->Format->cIcon('edit.png');
-		$expected = '<img src="/img/icons/edit.png" title="' . __d('tools', 'Edit') . '" alt="[' . __d('tools', 'Edit') . ']" class="icon" />';
+		$expected = '<img src="/img/icons/edit.png" title="' . __d('tools', 'Edit') . '" alt="[' . __d('tools', 'Edit') . ']" class="icon"/>';
 		$this->assertEquals($expected, $result);
 	}
 
@@ -390,7 +390,7 @@ class FormatHelperTest extends MyCakeTestCase {
 			'next' => ['ModelName' => ['id' => 2, 'foo' => 'y']],
 		];
 		$result = $this->Format->neighbors($neighbors, 'foo');
-		$expected = '<div class="next-prev-navi nextPrevNavi"><a href="/index/1" title="bar"><img src="/img/icons/prev" alt="[]" class="icon" />&nbsp;prevRecord</a>&nbsp;&nbsp;<a href="/index/2" title="y"><img src="/img/icons/next" alt="[]" class="icon" />&nbsp;nextRecord</a></div>';
+		$expected = '<div class="next-prev-navi nextPrevNavi"><a href="/index/1" title="bar"><img src="/img/icons/prev" alt="[]" class="icon"/>&nbsp;prevRecord</a>&nbsp;&nbsp;<a href="/index/2" title="y"><img src="/img/icons/next" alt="[]" class="icon"/>&nbsp;nextRecord</a></div>';
 
 		$this->assertEquals($expected, $result);
 

+ 2 - 2
Test/Case/View/Helper/GravatarHelperTest.php

@@ -168,11 +168,11 @@ class GravatarHelperTest extends MyCakeTestCase {
 	 * @return void
 	 */
 	public function testImageTag() {
-		$expected = '<img src="http://www.gravatar.com/avatar/' . md5('example@gravatar.com') . '" alt="" />';
+		$expected = '<img src="http://www.gravatar.com/avatar/' . md5('example@gravatar.com') . '" alt=""/>';
 		$result = $this->Gravatar->image('example@gravatar.com', ['ext' => false]);
 		$this->assertEquals($expected, $result);
 
-		$expected = '<img src="http://www.gravatar.com/avatar/' . md5('example@gravatar.com') . '" alt="Gravatar" />';
+		$expected = '<img src="http://www.gravatar.com/avatar/' . md5('example@gravatar.com') . '" alt="Gravatar"/>';
 		$result = $this->Gravatar->image('example@gravatar.com', ['ext' => false, 'alt' => 'Gravatar']);
 		$this->assertEquals($expected, $result);
 	}

+ 4 - 4
View/Helper/CommonHelper.php

@@ -250,7 +250,7 @@ class CommonHelper extends AppHelper {
 			$content['robots'] = ['noindex', 'nofollow', 'noarchive'];
 		}
 
-		$return = '<meta name="robots" content="' . implode(',', $content['robots']) . '" />';
+		$return = '<meta name="robots" content="' . implode(',', $content['robots']) . '"/>';
 		return $return;
 	}
 
@@ -267,7 +267,7 @@ class CommonHelper extends AppHelper {
 		}
 
 		$content = (array)$content;
-		$return = '<meta name="' . $name . '" content="' . implode(', ', $content) . '" />';
+		$return = '<meta name="' . $name . '" content="' . implode(', ', $content) . '"/>';
 		return $return;
 	}
 
@@ -369,7 +369,7 @@ class CommonHelper extends AppHelper {
 	 */
 	public function metaRss($url, $title = null) {
 		$tags = [
-			'meta' => '<link rel="alternate" type="application/rss+xml" title="%s" href="%s" />',
+			'meta' => '<link rel="alternate" type="application/rss+xml" title="%s" href="%s"/>',
 		];
 		if (empty($title)) {
 			$title = __d('tools', 'Subscribe to this feed');
@@ -389,7 +389,7 @@ class CommonHelper extends AppHelper {
 	 */
 	public function metaEquiv($type, $value, $escape = true) {
 		$tags = [
-			'meta' => '<meta http-equiv="%s"%s />',
+			'meta' => '<meta http-equiv="%s"%s/>',
 		];
 		if ($value === null) {
 			return '';