/** * @dataProvider isAllowedMethodProvider */ public function testIsAllowedMethod($method, $expected) { $id = 1; $name = 'Libcaca'; $l = new Language(); $l->setId($id); $l->setName($name); $this->assertEquals($expected, $l->isAllowedMethod($method)); }
public function testToJson() { $l = new Language(); $l->setId(123); $l->setName('Language'); $ug = new UserGroup(); $ug->setId(456); $ug->setName('UserGroup'); $id = 1; $dt = new \DateTime(); $w = new Site(); $w->setId($id); $w->setName('Website'); $w->setUserGroup($ug); $w->setUrl('www.example.com'); $w->setLanguage($l); $w->setIsArchived(false); $w->setUpdatedAt($dt); $data = json_decode($w); $lCopy = new Language(); $lCopy->setId($data->languageId); $lCopy->setName('Language'); $ugCopy = new UserGroup(); $ugCopy->setId($data->userGroupId); $ugCopy->setName('UserGroup'); $dtCopy = new \DateTime($data->updatedAt); $wCopy = new Site(); $wCopy->setId($data->id); $wCopy->setName($data->name); $wCopy->setUserGroup($ugCopy); $wCopy->setUrl('www.example.com'); $wCopy->setLanguage($lCopy); $wCopy->setIsArchived($data->isArchived); $wCopy->setUpdatedAt($dtCopy); $this->assertEquals($w, $wCopy, "Websites are different"); }