euromark 11 年 前
コミット
18b1d3bd51
2 ファイル変更17 行追加9 行削除
  1. 0 4
      Controller/Component/FlashComponent.php
  2. 17 5
      Test/Case/Lib/GooglLibTest.php

+ 0 - 4
Controller/Component/FlashComponent.php

@@ -1,8 +1,6 @@
 <?php
 
 App::uses('Component', 'Controller');
-App::uses('Sanitize', 'Utility');
-App::uses('Utility', 'Tools.Utility');
 
 /**
  * A flash component to enhance flash message support with stackable messages, both
@@ -16,8 +14,6 @@ class FlashComponent extends Component {
 
 	public $components = array('Session');
 
-	public $userModel = CLASS_USER;
-
 	/**
 	 * For automatic startup
 	 * for this helper the controller has to be passed as reference

+ 17 - 5
Test/Case/Lib/GooglLibTest.php

@@ -33,6 +33,11 @@ class GooglLibTest extends CakeTestCase {
 		die();
 	}
 
+	/**
+	 * GooglLibTest::testShortenAndUnshorten()
+	 *
+	 * @return void
+	 */
 	public function testShortenAndUnshorten() {
 		//echo '<h2>Shorten without key (publically)</h2>';
 		Configure::write('Googl.key', '');
@@ -40,24 +45,31 @@ class GooglLibTest extends CakeTestCase {
 		$url = 'http://www.spiegel.de';
 		$is = $this->Googl->getShort($url);
 		//pr($is);
-		$res = $this->assertTrue(!empty($is) && is_array($is) && !empty($is['id']) && $is['kind'] === 'urlshortener#url' && $is['longUrl'] == $url . '/');
+		$this->assertTrue(!empty($is) && is_array($is) && !empty($is['id']) && $is['kind'] === 'urlshortener#url' && $is['longUrl'] == $url . '/');
 
 		//echo '<h2>Unshorten</h2>';
 
 		$shortUrl = $is['id'];
 		$is = $this->Googl->getLong($shortUrl);
-		//pr($is);
-		$res = $this->assertTrue(!empty($is) && is_array($is) && !empty($is['id']) && $is['kind'] === 'urlshortener#url' && $is['status'] === 'OK' && $is['longUrl'] == $url . '/');
+		$this->assertTrue(!empty($is));
+		$this->assertTrue(!empty($is['id']));
+		$this->assertSame('urlshortener#url', $is['kind']);
+		$this->assertSame('OK', $is['status']);
+		$this->assertSame($url . '/', $is['longUrl']);
 	}
 
+	/**
+	 * GooglLibTest::testApi()
+	 *
+	 * @return void
+	 */
 	public function testApi() {
 		$this->skipIf(!Configure::write('Googl.key'), 'No Api Key found');
 
 		//echo '<h2>Shorten with key</h2>';
 
-		$url = 'http://www.gmx.de';
+		$url = 'http://www.blue.de';
 		$is = $this->Googl->getShort($url);
-		//pr($is);
 		$res = $this->assertTrue(!empty($is) && is_array($is) && !empty($is['id']) && $is['kind'] === 'urlshortener#url' && $is['longUrl'] == $url . '/');
 
 		//echo '<h2>Unshorten</h2>';