Ejemplo n.º 1
0
 public function getEndpointNameProvider()
 {
     $l = Language::createFromArray(['id' => 1, 'name' => 'French']);
     $ug = UserGroup::createFromArray(['id' => 1, 'name' => 'UserGroup Test']);
     $s = Site::createFromArray(['id' => 1, 'name' => 'Example Site', 'userGroupId' => 2, 'url' => 'http://example.com', 'languageId' => 3, 'updatedAt' => '1984-06-01 07:32:23', 'isArchived' => true]);
     // instance, name, expected
     return [[$l, null, 'languages'], [$ug, null, 'usergroups'], [$s, null, 'sites'], [$s, 'customname', 'customname']];
 }
Ejemplo n.º 2
0
 public function testCreateFromArray()
 {
     $data = ['id' => 1, 'name' => 'Libcaca'];
     $lFromArray = Language::createFromArray($data);
     $lFromObject = Language::createFromArray((object) $data);
     $this->assertInstanceOf('Core\\Language', $lFromArray);
     $this->assertInstanceOf('Core\\Language', $lFromObject);
     $this->assertEquals($lFromArray, $lFromObject, 'Languages are different');
     $this->assertEquals(1, $lFromArray->getId());
     $this->assertEquals(1, $lFromObject->getId());
 }