Пример #1
0
 /**
  * Test the getAvailableFields() method
  */
 public function testGetAvailableFields()
 {
     $allFields = CustomExport::getAllFields();
     $allCount = count($allFields);
     $export = new CustomExport();
     $export->setName("NewExport12");
     // Assign everything
     $export->setAssignedFields($allFields);
     $available = $export->getAvailableFields();
     $this->assertTrue(is_array($available));
     $this->assertEquals(0, count($available));
     // Assign 3 fields
     $assign = array("empId", "firstName", "gender");
     $export->setAssignedFields($assign);
     $available = $export->getAvailableFields();
     $this->assertTrue(is_array($available));
     $this->assertEquals($allCount - 3, count($available));
     $expected = $allFields;
     unset($expected[array_search("empId", $expected)]);
     unset($expected[array_search("firstName", $expected)]);
     unset($expected[array_search("gender", $expected)]);
     // Verify arrays equal
     $diff = array_diff($expected, $available);
     $this->assertEquals(0, count($diff), "Arrays should be equal");
 }