/**
  * @covers TheSportsDb\Entity\Factory\FactoryContainer::setDefaultFactory
  */
 public function testSetDefaultFactory()
 {
     $factory = $this->getMockBuilder(Factory::class)->disableOriginalConstructor()->getMock();
     $this->factoryContainer->setDefaultFactory($factory);
     $this->assertEquals($factory, $this->factoryContainer->getFactory('testEntityType'));
     $this->assertEquals($factory, $this->factoryContainer->getFactory('testEntityType2'));
 }
 /**
  * Test TheSportsDb\PropertyMapper\PropertyDefinition::sanitizeProperty with
  * an array of entities property.
  */
 private function _testSanitizePropertyEntityArray()
 {
     // Factory container.
     $factoryContainer = new FactoryContainer();
     // Array of entities.
     $propdef = new PropertyDefinition('testProp', 'mockEntityType', TRUE);
     // Data.
     $data = new \stdClass();
     $data->testProp = array();
     // Mock entities.
     $entity1 = $this->getMockBuilder(EntityInterface::class)->setMockClassName('MockEntity1')->getMock();
     $entity2 = $this->getMockBuilder(EntityInterface::class)->setMockClassName('MockEntity2')->getMock();
     // Set entities as properties.
     $data->testProp[0] = $entity1;
     $data->testProp[1] = $entity2;
     // Mock factory.
     $factory = $this->getMockBuilder(FactoryInterface::class)->disableOriginalConstructor()->getMock();
     $factoryContainer->addFactory($factory, 'mockEntityType');
     // Mock factory create method (should never be called, items are already
     // entities).
     $factory->expects($this->never())->method($this->anything());
     // Test method.
     $propdef->sanitizeProperty($data, $factoryContainer);
     $this->assertEquals($entity1, $data->testProp[0]);
     $this->assertEquals($entity2, $data->testProp[1]);
 }