/** * Test the getAllProjects() function in PageAssessmentsBody class */ public function testGetAllProjects() { $pageBody = new PageAssessmentsBody(); // Insert a record $this->testInsert(); $values = array('pa_page_id' => '10', 'pa_project_id' => '4', 'pa_class' => 'B', 'pa_importance' => 'Low', 'pa_page_revision' => '21'); // Insert another record $pageBody->insertRecord($values); $res = $pageBody->getAllProjects('10'); $expected = array(3, 4); // Since the projects may be returned in any order, we can't do a simple // assertEquals() on the arrays. Instead we compare the arrays using array_diff() // in both directions and make sure that the results are empty. $this->assertEmpty(array_merge(array_diff($expected, $res), array_diff($res, $expected))); }