ソースを参照

deprecate some methods

euromark 12 年 前
コミット
fab3b40110
2 ファイル変更16 行追加9 行削除
  1. 12 9
      Test/Case/View/Helper/CommonHelperTest.php
  2. 4 0
      View/Helper/CommonHelper.php

+ 12 - 9
Test/Case/View/Helper/CommonHelperTest.php

@@ -1,6 +1,7 @@
 <?php
 
 App::uses('CommonHelper', 'Tools.View/Helper');
+App::uses('HtmlHelper', 'Tools.View/Helper');
 App::uses('View', 'View');
 App::uses('MyCakeTestCase', 'Tools.TestSuite');
 
@@ -16,7 +17,9 @@ class CommonHelperTest extends MyCakeTestCase {
 			Configure::write('App.fullBaseUrl', 'http://localhost');
 		}
 
-		$this->Common = new CommonHelper(new View(null));
+		$View = new View(null);
+		$this->Common = new CommonHelper($View);
+		$this->Html = new CommonHelper($View);
 	}
 
 	/**
@@ -24,7 +27,7 @@ class CommonHelperTest extends MyCakeTestCase {
 	public function testMetaCanonical() {
 		$is = $this->Common->metaCanonical('/some/url/param1');
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . Configure::read('App.fullBaseUrl') . $this->Common->url('/some/url/param1') . '" rel="canonical" />', trim($is));
+		$this->assertEquals('<link href="' . Configure::read('App.fullBaseUrl') . $this->Html->url('/some/url/param1') . '" rel="canonical" />', trim($is));
 	}
 
 	/**
@@ -32,22 +35,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->Common->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(array('controller' => 'some', 'action' => 'url'), 'de', true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Common->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(array('controller' => 'some', 'action' => 'url'), array('de', 'de-ch'), true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Common->url('/some/url', true) . '" rel="alternate" hreflang="de" />' . PHP_EOL . '<link href="' . FULL_BASE_URL . $this->Common->url('/some/url') . '" 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="' . FULL_BASE_URL . $this->Html->url('/some/url') . '" rel="alternate" hreflang="de-ch" />', trim($is));
 
 		$is = $this->Common->metaAlternate(array('controller' => 'some', 'action' => 'url'), array('de' => array('ch', 'at'), 'en' => array('gb', 'us')), true);
 		$this->out(h($is));
-		$this->assertEquals('<link href="' . $this->Common->url('/some/url', true) . '" rel="alternate" hreflang="de-ch" />' . PHP_EOL .
-			'<link href="' . $this->Common->url('/some/url', true) . '" rel="alternate" hreflang="de-at" />' . PHP_EOL .
-			'<link href="' . $this->Common->url('/some/url', true) . '" rel="alternate" hreflang="en-gb" />' . PHP_EOL .
-			'<link href="' . $this->Common->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));
 	}
 
 	/**

+ 4 - 0
View/Helper/CommonHelper.php

@@ -189,6 +189,7 @@ class CommonHelper extends AppHelper {
 	 * => z is in plugins/tools/packages/jquery/files/jquery/sub/
 	 *
 	 * @return string htmlMarkup
+	 * @deprecated Use AssetCompress plugin instead
 	 */
 	public function css($files = array(), $options = array()) {
 		$files = (array)$files;
@@ -210,6 +211,7 @@ class CommonHelper extends AppHelper {
 	 * => z is in plugins/tools/packages/jquery/files/jquery/sub/
 	 *
 	 * @return string htmlMarkup
+	 * @deprecated Use AssetCompress plugin instead
 	 */
 	public function script($files = array(), $options = array()) {
 		$files = (array)$files;
@@ -231,6 +233,7 @@ class CommonHelper extends AppHelper {
 	 * Note: needs Asset.cssversion => xyz (going up with counter)
 	 *
 	 * @return string htmlMarkup
+	 * @deprecated Use AssetCompress plugin instead
 	 */
 	public function cssDyn($path, $options = array()) {
 		$v = (int)Configure::read('Asset.version');
@@ -244,6 +247,7 @@ class CommonHelper extends AppHelper {
 	 * Note: needs Asset.timestamp => force
 	 *
 	 * @return string htmlMarkup
+	 * @deprecated Use AssetCompress plugin instead
 	 */
 	public function cssAuto($path, $htmlAttributes = array()) {
 		$compress = Configure::read('App.compressCss');