Esempio n. 1
0
 protected function setUp()
 {
     $this->manufacturer = new Manufacturer();
     $this->manufacturer->setName('adidas');
     $this->product = new Product();
     $this->product->setName('test product')->setCount(self::TEST_COUNT)->setPrice(self::TEST_PRICE)->setManufacturer($this->manufacturer)->setDescription('description')->setCreateDate(new \DateTime());
     foreach ($this->categories as $categoryName) {
         $category = new Category();
         $category->setName($categoryName)->addProduct($this->product);
         $this->product->addCategory($category);
         if (!$this->category) {
             $this->category = $category;
         }
     }
     $this->manufacturer->addProduct($this->product);
     $eventDispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock();
     $mapperProvider = new SearchMappingProvider($eventDispatcher);
     $mapperProvider->setMappingConfig($this->mappingConfig);
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->mapper = new ObjectMapper($this->dispatcher, $this->mappingConfig);
     $this->mapper->setMappingProvider($mapperProvider);
 }