Browse Source

more tests fixed

euromark 13 years ago
parent
commit
710d8421ae
2 changed files with 82 additions and 0 deletions
  1. 13 0
      Test/Case/Model/Behavior/SluggedBehaviorTest.php
  2. 69 0
      Test/Fixture/MessageFixture.php

+ 13 - 0
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -221,6 +221,19 @@ class SluggedBehaviorTest extends CakeTestCase {
  * test remove stop words
  */
 	public function testRemoveStopWords() {
+		$skip = false;
+		$lang = Configure::read('Site.lang');
+		if (!$lang) {
+			$lang = 'eng';
+		}
+		if (
+			!App::import('Vendor', 'stop_words_' . $lang, array('file' => "stop_words".DS."$lang.txt")) &&
+			!App::import('Vendor', 'Tools.stop_words_' . $lang, array('file' => "stop_words".DS."$lang.txt"))
+		) {
+			$skip = true;
+		}
+		$this->skipIf($skip, 'no stop_words/'.$lang.'.txt file found');
+
 		$array = $this->Model->removeStopWords('My name is Michael Paine, and I am a nosey neighbour');
 		$expected = array(
 			'Michael Paine',

+ 69 - 0
Test/Fixture/MessageFixture.php

@@ -0,0 +1,69 @@
+<?php
+/**
+ * Short description for message_fixture.php
+ *
+ * Long description for message_fixture.php
+ *
+ * PHP version 5
+ *
+ * Copyright (c) 2008, Andy Dawson
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) 2008, Andy Dawson
+ * @link www.ad7six.com
+ * @package mi
+ * @subpackage mi.tests.fixtures
+ * @since v 1.0
+ * @modifiedBy $LastChangedBy$
+ * @lastModified $Date$
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+
+/**
+ * MessageFixture class
+ *
+ * @uses CakeTestFixture
+ * @package mi
+ * @subpackage mi.tests.fixtures
+ */
+class MessageFixture extends CakeTestFixture {
+
+	/**
+	 * fields property
+	 *
+	 * @var array
+	 * @access public
+	 */
+	public $fields = array(
+		'id' => array('type' => 'integer', 'key' => 'primary'),
+		'random' => array('type' => 'integer', 'null' => false),
+		'name' => array('type' => 'string', 'null' => false),
+		'slug' => array('type' => 'string', 'null' => true),
+		'section' => array('type' => 'integer', 'null' => true),
+	);
+
+	/**
+	 * records property
+	 *
+	 * The records are created out of sequence so that theirs id are not sequncial.
+	 * The order field values are used only in the list behavior test
+	 *
+	 * @var array
+	 * @access public
+	 */
+	public $records = array(
+		array('random' => 1, 'name' => 'First'),
+		array('random' => 10, 'name' => 'Tenth'),
+		array('random' => 4, 'name' => 'Fourth'),
+		array('random' => 8, 'name' => 'Eigth'),
+		array('random' => 5, 'name' => 'Fifth'),
+		array('random' => 7, 'name' => 'Seventh'),
+		array('random' => 3, 'name' => 'Third'),
+		array('random' => 9, 'name' => 'Ninth'),
+		array('random' => 2, 'name' => 'Second'),
+		array('random' => 6, 'name' => 'Sixth'),
+	);
+
+}