Example #1
0
 /**
  * @covers TheSportsDb\Entity\Entity::transform
  */
 public function testTransform()
 {
     $mapper = $this->getMockBuilder(MapperInterface::class)->getMock();
     $entityManager = new EntityManager($mapper);
     $repository = $this->getMockBuilder(Repository::class)->disableOriginalConstructor()->getMock();
     $repository->expects($this->once())->method('byId')->willReturn($this->entity);
     $repositoryContainer = $this->getMockBuilder(RepositoryContainerInterface::class)->getMock();
     $repositoryContainer->expects($this->once())->method('getRepository')->with('testEntityType')->willReturn($repository);
     $entityManager->setRepositoryContainer($repositoryContainer);
     $this->assertEquals($this->entity, Entity::transform('id', NULL, $entityManager, 'testEntityType', 'id'));
 }
 /**
  * @covers TheSportsDb\Entity\EntityManager::isFullObject
  */
 public function testIsFullObject()
 {
     $this->entityManager->registerClass('testEntity', 'TheSportsDb\\Test\\Entity\\TestEntity');
     $this->assertTrue($this->entityManager->isFullObject((object) array('id' => '123', 'name' => 'name123'), 'testEntity'));
     $this->assertFalse($this->entityManager->isFullObject((object) array('id' => '123'), 'testEntity'));
 }