/** * @depends testInitializeRepositoryWithAutoStrategy * @depends testInsertFirstEntityWithAutoStrategy * @param SampleRepository $repository * @param SampleEntity $entity */ public function testFetchOneByEntityInstance($repository, $entity) { $entity = SampleEntity::fromArray(array('id' => $entity->id)); $entity = $repository->fetchOneBy($entity); $this->assertInstanceOf('\\DataMonkey\\Tests\\Mocks\\SampleEntity', $entity); }
public function testFactory() { $entity = SampleEntity::factory($this->_exported_data); $this->assertInstanceOf('\\DataMonkey\\Tests\\Mocks\\SampleEntity', $entity); $data = $entity->export(); foreach ($data as $key => $value) { $this->assertEquals($this->_exported_data[$key], $value); } }
public function create($options = null) { return SampleEntity::factory($options); }