/** * testTagFind * * @return void * @access public */ public function testTagFind() { $this->GlobalTag->recursive = -1; $results = $this->GlobalTag->find('first'); $this->assertNotEmpty($results); $expected = array('GlobalTag' => array('id' => '1', 'identifier' => null, 'name' => 'CakePHP', 'keyname' => 'cakephp', 'weight' => '2', 'created' => '2008-06-02 18:18:11', 'modified' => '2008-06-02 18:18:37', 'description' => 'nice')); $this->assertEquals($expected, $results); }
/** * testAdd * * @return void */ public function testAdd() { $result = $this->Tag->add(array('Tag' => array('tags' => 'tag1, tag2, tag3'))); $this->assertTrue($result); $result = $this->Tag->find('all', array('recursive' => -1, 'fields' => array('Tag.name'))); $result = Set::extract($result, '{n}.Tag.name'); $this->assertTrue(in_array('tag1', $result)); $this->assertTrue(in_array('tag2', $result)); $this->assertTrue(in_array('tag3', $result)); }