diff --git a/Test/Case/Controller/TagsControllerTest.php b/Test/Case/Controller/TagsControllerTest.php index 5e9ea3d..8303e96 100644 --- a/Test/Case/Controller/TagsControllerTest.php +++ b/Test/Case/Controller/TagsControllerTest.php @@ -129,10 +129,10 @@ public function testIndex() { public function testView() { $this->Tags->view('cakephp'); $this->assertTrue(!empty($this->Tags->viewVars['tag'])); - $this->assertEqual($this->Tags->viewVars['tag']['Tag']['keyname'], 'cakephp'); + $this->assertEquals($this->Tags->viewVars['tag']['Tag']['keyname'], 'cakephp'); $this->Tags->view('invalid-key-name!'); - $this->assertEqual($this->Tags->redirectUrl, '/'); + $this->assertEquals($this->Tags->redirectUrl, '/'); } /** @@ -143,10 +143,10 @@ public function testView() { public function testAdminView() { $this->Tags->admin_view('cakephp'); $this->assertTrue(!empty($this->Tags->viewVars['tag'])); - $this->assertEqual($this->Tags->viewVars['tag']['Tag']['keyname'], 'cakephp'); + $this->assertEquals($this->Tags->viewVars['tag']['Tag']['keyname'], 'cakephp'); $this->Tags->admin_view('invalid-key-name!'); - $this->assertEqual($this->Tags->redirectUrl, '/'); + $this->assertEquals($this->Tags->redirectUrl, '/'); } /** @@ -177,10 +177,10 @@ public function testAdminDelete() { $this->Tags->admin_delete('WRONG-ID!!!'); - $this->assertEqual($this->Tags->redirectUrl, array('action' => 'index')); + $this->assertEquals($this->Tags->redirectUrl, array('action' => 'index')); $this->Tags->admin_delete('tag-1'); - $this->assertEqual($this->Tags->redirectUrl, array('action' => 'index')); + $this->assertEquals($this->Tags->redirectUrl, array('action' => 'index')); } /** @@ -193,7 +193,7 @@ public function testAdminAdd() { 'Tag' => array( 'tags' => 'tag1, tag2, tag3')); $this->Tags->admin_add(); - $this->assertEqual($this->Tags->redirectUrl, array('action' => 'index')); + $this->assertEquals($this->Tags->redirectUrl, array('action' => 'index')); } /** @@ -205,16 +205,16 @@ public function testAdminEdit() { $this->Tags->admin_edit('tag-1'); $tag = array( 'Tag' => array( - 'id' => 'tag-1', - 'identifier' => null, - 'name' => 'CakePHP', - 'keyname' => 'cakephp', + 'id' => 'tag-1', + 'identifier' => null, + 'name' => 'CakePHP', + 'keyname' => 'cakephp', 'occurrence' => 1, 'article_occurrence' => 1, - 'created' => '2008-06-02 18:18:11', - 'modified' => '2008-06-02 18:18:37')); + 'created' => '2008-06-02 18:18:11', + 'modified' => '2008-06-02 18:18:37')); - $this->assertEqual($this->Tags->data, $tag); + $this->assertEquals($this->Tags->data, $tag); $this->Tags->data = array( 'Tag' => array( @@ -222,6 +222,6 @@ public function testAdminEdit() { 'name' => 'CAKEPHP')); $this->Tags->admin_edit('tag-1'); - $this->assertEqual($this->Tags->redirectUrl, array('action' => 'index')); + $this->assertEquals($this->Tags->redirectUrl, array('action' => 'index')); } } diff --git a/Test/Case/Model/Behavior/TaggableBehaviorTest.php b/Test/Case/Model/Behavior/TaggableBehaviorTest.php index 6344b83..33e0ec6 100644 --- a/Test/Case/Model/Behavior/TaggableBehaviorTest.php +++ b/Test/Case/Model/Behavior/TaggableBehaviorTest.php @@ -137,7 +137,7 @@ public function testOccurrenceCache() { 'conditions' => array( 'Tag.keyname' => 'cakephp'))); - $this->assertEqual($resultAfter['Tag']['occurrence'] - $resultBefore['Tag']['occurrence'], 1); + $this->assertEquals($resultAfter['Tag']['occurrence'] - $resultBefore['Tag']['occurrence'], 1); // updating the record to not have the cakephp tag anymore, decreases the occurrence $data = array('id' => $this->Article->id, 'title' => 'Test Article', 'tags' => 'php, something, else'); @@ -146,7 +146,7 @@ public function testOccurrenceCache() { 'contain' => array(), 'conditions' => array( 'Tag.keyname' => 'cakephp'))); - $this->assertEqual($resultAfter['Tag']['occurrence'], 1); + $this->assertEquals($resultAfter['Tag']['occurrence'], 1); } /** @@ -171,7 +171,7 @@ public function testTagSaving() { 'id' => 'article-1'))); $this->assertTrue(!empty($result['Article']['tags'])); - $this->assertEqual(3, count($result['Tag'])); + $this->assertEquals(3, count($result['Tag'])); $data['tags'] = 'cakephp:foo, developer, cakephp:developer, cakephp:php'; @@ -183,7 +183,7 @@ public function testTagSaving() { 'Tag.identifier' => 'cakephp'))); $result = Set::extract($result, '{n}.Tag.keyname'); - $this->assertEqual($result, array( + $this->assertEquals($result, array( 'developer', 'foo', 'php')); $this->assertFalse($this->Article->saveTags('foo, bar', null)); @@ -206,13 +206,13 @@ public function testSaveTimesTagged() { 'contain' => array('Tag'), )); $fooCount = Set::extract('/Tag[keyname=foo]/../Tagged/times_tagged', $result); - $this->assertEqual($fooCount, array(2)); + $this->assertEquals($fooCount, array(2)); $barCount = Set::extract('/Tag[keyname=bar]/../Tagged/times_tagged', $result); - $this->assertEqual($barCount, array(2)); + $this->assertEquals($barCount, array(2)); $testCount = Set::extract('/Tag[keyname=test]/../Tagged/times_tagged', $result); - $this->assertEqual($testCount, array(2)); + $this->assertEquals($testCount, array(2)); } /** @@ -243,10 +243,10 @@ public function testTagArrayToString() { */ public function testMultibyteKey() { $result = $this->Article->multibyteKey('this is _ a Nice ! - _ key!'); - $this->assertEqual('thisisanicekey', $result); + $this->assertEquals('thisisanicekey', $result); $result = $this->Article->multibyteKey('Äü-Ü_ß'); - $this->assertEqual('äüüß', $result); + $this->assertEquals('äüüß', $result); } /** diff --git a/Test/Case/Model/TagTest.php b/Test/Case/Model/TagTest.php index 8c8f6aa..314709d 100644 --- a/Test/Case/Model/TagTest.php +++ b/Test/Case/Model/TagTest.php @@ -84,7 +84,7 @@ public function testTagFind() { 'article_occurrence' => 1, 'created' => '2008-06-02 18:18:11', 'modified' => '2008-06-02 18:18:37')); - $this->assertEqual($results, $expected); + $this->assertEquals($results, $expected); } /** @@ -95,7 +95,7 @@ public function testTagFind() { public function testView() { $result = $this->Tag->view('cakephp'); $this->assertTrue(is_array($result)); - $this->assertEqual($result['Tag']['keyname'], 'cakephp'); + $this->assertEquals($result['Tag']['keyname'], 'cakephp'); $this->expectException('CakeException'); $this->Tag->view('invalid-key!!!'); @@ -128,7 +128,7 @@ public function testAdd() { */ public function testEdit() { $this->assertNull($this->Tag->edit('tag-1')); - $this->assertEqual($this->Tag->data['Tag']['id'], 'tag-1'); + $this->assertEquals($this->Tag->data['Tag']['id'], 'tag-1'); $data = array( 'Tag' => array( @@ -147,7 +147,7 @@ public function testEdit() { 'id' => 'tag-1', 'name' => 'CAKEPHP', 'keyname' => '')); - $this->assertEqual($this->Tag->edit('tag-1', $data), $data); + $this->assertEquals($this->Tag->edit('tag-1', $data), $data); $this->expectException('CakeException'); $this->assertTrue($this->Tag->edit('invalid-id', array())); diff --git a/Test/Case/Model/TaggedTest.php b/Test/Case/Model/TaggedTest.php index 3449163..b2cae29 100644 --- a/Test/Case/Model/TaggedTest.php +++ b/Test/Case/Model/TaggedTest.php @@ -16,9 +16,17 @@ * TagggedArticle Test Model */ class TaggedArticle extends Model { + public $useTable = 'articles'; + public $actsAs = array( - 'Tags.Taggable'); + 'Tags.Taggable' + ); + + public $belongsTo = array( + 'User' + ); + } /** @@ -45,7 +53,8 @@ class TaggedTest extends CakeTestCase { 'plugin.tags.tagged', 'plugin.tags.tag', 'plugin.tags.article', - 'plugin.tags.user'); + 'plugin.tags.user' + ); /** * setUp @@ -98,7 +107,7 @@ public function testTaggedFind() { 'created' => '2008-12-02 12:32:31', 'modified' => '2008-12-02 12:32:31')); - $this->assertEqual($result, $expected); + $this->assertEquals($result, $expected); } /** @@ -110,16 +119,16 @@ public function testFindCloud() { $result = $this->Tagged->find('cloud', array( 'model' => 'Article')); - $this->assertEqual(count($result), 3); + $this->assertEquals(count($result), 3); $this->assertTrue(isset($result[0][0]['occurrence'])); - $this->assertEqual($result[0][0]['occurrence'], 1); + $this->assertEquals($result[0][0]['occurrence'], 1); $result = $this->Tagged->find('cloud'); $this->assertTrue(is_array($result) && !empty($result)); $result = $this->Tagged->find('cloud', array( 'limit' => 1)); - $this->assertEqual(count($result), 1); + $this->assertEquals(count($result), 1); } /** @@ -132,18 +141,17 @@ public function testFindTagged() { $result = $this->Tagged->find('tagged', array( 'by' => 'cakephp', 'model' => 'Article')); - $this->assertEqual(count($result), 1); - $this->assertEqual($result[0]['Article']['id'], 'article-1'); + $this->assertEquals(count($result), 1); + $this->assertEquals($result[0]['Article']['id'], 'article-1'); $result = $this->Tagged->find('tagged', array( 'model' => 'Article')); - $this->assertEqual(count($result), 2); - + $this->assertEquals(count($result), 2); // Test call to paginateCount by Controller::pagination() $result = $this->Tagged->paginateCount(array(), 1, array( 'model' => 'Article', 'type' => 'tagged')); - $this->assertEqual($result, 2); + $this->assertEquals($result, 2); } /** @@ -157,14 +165,14 @@ public function testFindTaggedWithConditions() { 'by' => 'cakephp', 'model' => 'Article', 'conditions' => array('Article.title LIKE' => 'Second %'))); - $this->assertEqual(count($result), 0); + $this->assertEquals(count($result), 0); $result = $this->Tagged->find('tagged', array( 'by' => 'cakephp', 'model' => 'Article', 'conditions' => array('Article.title LIKE' => 'First %'))); - $this->assertEqual(count($result), 1); - $this->assertEqual($result[0]['Article']['id'], 'article-1'); + $this->assertEquals(count($result), 1); + $this->assertEquals($result[0]['Article']['id'], 'article-1'); } /** @@ -189,7 +197,7 @@ public function testDeepAssociationsHasOne() { 'Article' => array( 'User')))); - $this->assertEqual($result[0]['Article']['User']['name'], 'CakePHP'); + $this->assertEquals($result[0]['Article']['User']['name'], 'CakePHP'); } /** @@ -214,7 +222,7 @@ public function testDeepAssociationsBelongsTo() { 'Article' => array( 'User')))); - $this->assertEqual($result[0]['Article']['User']['name'], 'CakePHP'); + $this->assertEquals($result[0]['Article']['User']['name'], 'CakePHP'); } } diff --git a/Test/Case/View/Helper/TagCloudHelperTest.php b/Test/Case/View/Helper/TagCloudHelperTest.php index 1f99903..7786c16 100644 --- a/Test/Case/View/Helper/TagCloudHelperTest.php +++ b/Test/Case/View/Helper/TagCloudHelperTest.php @@ -72,7 +72,7 @@ public function setUp() { * @return void */ public function testDisplay() { - $this->assertEqual($this->TagCloud->display(), ''); + $this->assertEquals($this->TagCloud->display(), ''); // Test tags shuffling $options = array( @@ -89,7 +89,7 @@ public function testDisplay() { $options = array( 'shuffle' => false); $result = $this->TagCloud->display($this->sampleTags, $options); - $this->assertEqual($result, $expected); + $this->assertEquals($result, $expected); // Test options $options = array_merge($options, array( @@ -103,14 +103,14 @@ public function testDisplay() { $result = $this->TagCloud->display($this->sampleTags, $options); $expected = 'CakePHP '. 'CakeDC '; - $this->assertEqual($result, $expected); + $this->assertEquals($result, $expected); $tags = $this->sampleTags; $tags[1]['Tag']['weight'] = 1; $result = $this->TagCloud->display($tags, $options); $expected = 'CakePHP '. 'CakeDC '; - $this->assertEqual($result, $expected); + $this->assertEquals($result, $expected); } public function testDisplayShouldDefineCorrectSizeWhenCustomWeightField() { @@ -127,7 +127,7 @@ public function testDisplayShouldDefineCorrectSizeWhenCustomWeightField() { $result = $this->TagCloud->display($tags, $options); $expected = 'CakePHP '. 'CakeDC '; - $this->assertEqual($result, $expected); + $this->assertEquals($result, $expected); } /** diff --git a/Test/Fixture/ArticleFixture.php b/Test/Fixture/ArticleFixture.php index 94263d1..2edfe6d 100644 --- a/Test/Fixture/ArticleFixture.php +++ b/Test/Fixture/ArticleFixture.php @@ -23,9 +23,10 @@ class ArticleFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36), 'title' => array('type' => 'string', 'null' => false), - 'user_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36)); + 'user_id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36) + ); /** * records property @@ -44,5 +45,7 @@ class ArticleFixture extends CakeTestFixture { array( 'id' => 'article-3', 'title' => 'Third Article', - 'user_id' => 'user-3')); + 'user_id' => 'user-3' + ) + ); } diff --git a/Test/Fixture/TagFixture.php b/Test/Fixture/TagFixture.php index 122c068..75159b4 100644 --- a/Test/Fixture/TagFixture.php +++ b/Test/Fixture/TagFixture.php @@ -30,14 +30,14 @@ class TagFixture extends CakeTestFixture { * @var array $fields */ public $fields = array( - 'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'), - 'identifier' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'key' => 'index'), - 'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 30), - 'keyname' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 30), + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary'), + 'identifier' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 30, 'key' => 'index'), + 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 30), + 'keyname' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 30), 'occurrence' => array('type' => 'integer', 'null' => false, 'default' => 0, 'length' => 8), 'article_occurrence' => array('type' => 'integer', 'null' => false, 'default' => 0, 'length' => 8), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'UNIQUE_TAG' => array('column' => array('identifier', 'keyname'), 'unique' => 1) @@ -51,31 +51,33 @@ class TagFixture extends CakeTestFixture { */ public $records = array( array( - 'id' => 'tag-1', - 'identifier' => null, - 'name' => 'CakePHP', - 'keyname' => 'cakephp', + 'id' => 'tag-1', + 'identifier' => null, + 'name' => 'CakePHP', + 'keyname' => 'cakephp', 'occurrence' => 1, 'article_occurrence' => 1, - 'created' => '2008-06-02 18:18:11', - 'modified' => '2008-06-02 18:18:37'), + 'created' => '2008-06-02 18:18:11', + 'modified' => '2008-06-02 18:18:37'), array( - 'id' => 'tag-2', - 'identifier' => null, - 'name' => 'CakeDC', - 'keyname' => 'cakedc', + 'id' => 'tag-2', + 'identifier' => null, + 'name' => 'CakeDC', + 'keyname' => 'cakedc', 'occurrence' => 1, 'article_occurrence' => 1, - 'created' => '2008-06-01 18:18:15', - 'modified' => '2008-06-01 18:18:15'), + 'created' => '2008-06-01 18:18:15', + 'modified' => '2008-06-01 18:18:15'), array( - 'id' => 'tag-3', - 'identifier' => null, - 'name' => 'CakeDC', - 'keyname' => 'cakedc', + 'id' => 'tag-3', + 'identifier' => null, + 'name' => 'CakeDC', + 'keyname' => 'cakedc', 'occurrence' => 1, 'article_occurrence' => 1, - 'created' => '2008-06-01 18:18:15', - 'modified' => '2008-06-01 18:18:15')); + 'created' => '2008-06-01 18:18:15', + 'modified' => '2008-06-01 18:18:15' + ) + ); } diff --git a/Test/Fixture/TaggedFixture.php b/Test/Fixture/TaggedFixture.php index cf50eb4..1c5698d 100644 --- a/Test/Fixture/TaggedFixture.php +++ b/Test/Fixture/TaggedFixture.php @@ -30,14 +30,14 @@ class TaggedFixture extends CakeTestFixture { * @var array $fields */ public $fields = array( - 'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'), - 'foreign_key' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), - 'tag_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), - 'model' => array('type' => 'string', 'null' => false, 'default' => NULL, 'key' => 'index'), - 'language' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 6), + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary'), + 'foreign_key' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36), + 'tag_id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36), + 'model' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index'), + 'language' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 6), 'times_tagged' => array('type' => 'integer', 'null' => false, 'default' => 1), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'UNIQUE_TAGGING' => array('column' => array('model', 'foreign_key', 'tag_id', 'language'), 'unique' => 1),