Пример #1
0
 protected function setUp()
 {
     $this->container = $this->getMockForAbstractClass('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $manufacturer = new Manufacturer();
     $manufacturer->setName('adidas');
     $this->product = new Product();
     $this->product->setName('test product')->setCount(self::TEST_COUNT)->setPrice(self::TEST_PRICE)->setManufacturer($manufacturer)->setDescription('description')->setCreateDate(new \DateTime());
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->mapper = new ObjectMapper($this->dispatcher, $this->mappingConfig);
 }
Пример #2
0
 /**
  * @param  string  $name
  * @return Product
  */
 protected function createTestEntity($name)
 {
     $result = new Product();
     $result->setName($name);
     return $result;
 }
Пример #3
0
 public function testMapObjectForNullFieldsAndManyToOneRelation()
 {
     $product = new Product();
     $product->setName('test product');
     $expectedMapping = ['text' => ['name' => $product->getName(), 'all_data' => $product->getName(), Indexer::TEXT_ALL_DATA_FIELD => $product->getName()]];
     $this->assertEquals($expectedMapping, $this->mapper->mapObject($product));
 }