浏览代码

more tests

euromark 11 年之前
父节点
当前提交
93ce2c2dc3
共有 2 个文件被更改,包括 17 次插入2 次删除
  1. 6 1
      Test/Case/Console/Command/EncodingShellTest.php
  2. 11 1
      Test/Case/Model/Behavior/SluggedBehaviorTest.php

+ 6 - 1
Test/Case/Console/Command/EncodingShellTest.php

@@ -2,6 +2,7 @@
 
 App::uses('EncodingShell', 'Tools.Console/Command');
 App::uses('MyCakeTestCase', 'Tools.TestSuite');
+App::uses('TestConsoleOutput', 'Tools.TestSuite');
 
 class EncodingShellTest extends MyCakeTestCase {
 
@@ -10,7 +11,11 @@ class EncodingShellTest extends MyCakeTestCase {
 	public function setUp() {
 		parent::setUp();
 
-		$this->EncodingShell = new EncodingShell();
+		$output = new TestConsoleOutput();
+		$error = $this->getMock('ConsoleOutput', array(), array(), '', false);
+		$input = $this->getMock('ConsoleInput', array(), array(), '', false);
+
+		$this->EncodingShell = new EncodingShell($output, $error, $input);
 		$this->EncodingShell->initialize();
 		$this->EncodingShell->startup();
 	}

+ 11 - 1
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -736,7 +736,17 @@ class SluggedBehaviorTest extends CakeTestCase {
 			}
 		}
 
-		$this->testCustomChars();
+		Inflector::rules('transliteration', $rules);
+
+		$this->Model->Behaviors->unload('Slugged');
+		$this->Model->Behaviors->load('Tools.Slugged', array('mode' => 'ascii'));
+
+		foreach (self::$customMaps as $language => $map) {
+			foreach ($map as $from => $to) {
+				$result = $this->Model->slug($from, false);
+				$this->assertEquals($to, $result, $from . ' (' . $language . ') should become ' . $to . ' - but became ' . $result);
+			}
+		}
 	}
 
 	/**