/** * Test index */ public function testIndex() { $project = new Project_Models_Project(array('db' => $this->sharedFixture)); $project->title = 'CCÄC DDÖD TTÜT'; $project->path = '/1/'; $project->ownerId = 1; $project->projectId = 1; $project->save(); $project->saveRights(array(1 => 255, 2 => 255)); $search = new Phprojekt_Search(); $result = $search->search('CCÄC'); $this->assertEquals(1, count($result)); $result = $search->search('CCÄC DDÖD'); $this->assertEquals(1, count($result)); }
/** * Test edit history */ public function testEditCall() { $project = new Project_Models_Project(array('db' => $this->sharedFixture)); $history = new Phprojekt_History(array('db' => $this->sharedFixture)); $project->find(1); $project->title = 'EDITED TEST'; $project->save(); $history = new Phprojekt_History(array('db' => $this->sharedFixture)); $data = $history->getHistoryData($project, $project->id); $array = array('userId' => '1', 'moduleId' => '1', 'itemId' => '1', 'field' => 'title', 'label' => 'Title', 'oldValue' => 'PHProjekt', 'newValue' => 'EDITED TEST', 'action' => 'edit', 'datetime' => date("Y-m-d")); foreach ($data as &$e) { $e['datetime'] = substr($e['datetime'], 0, 10); } $this->assertContains($array, $data); }
/** * Test edit history */ public function testEditCall() { $project = new Project_Models_Project(array('db' => $this->sharedFixture)); $history = new Phprojekt_History(array('db' => $this->sharedFixture)); $project->find(Zend_Registry::get('insertedId')); $project->title = 'EDITED TEST'; $project->save(); $history = new Phprojekt_History(array('db' => $this->sharedFixture)); $data = $history->getHistoryData($project, $project->id); $array = array('userId' => '1', 'moduleId' => '1', 'itemId' => Zend_Registry::get('insertedId'), 'field' => 'title', 'label' => 'Title', 'oldValue' => 'TEST', 'newValue' => 'EDITED TEST', 'action' => 'edit', 'datetime' => date("Y-m-d")); $found = 0; foreach ($data as $values) { /* Remove the hour */ $values['datetime'] = substr($values['datetime'], 0, 10); $result = array_diff_assoc($values, $array); if (empty($result)) { $found = 1; } } if (!$found) { $this->fail('Save edit history error'); } }