/**
  * Test add/remove/get products methods
  */
 public function testGetProducts()
 {
     $product1 = $this->createProduct();
     $product2 = $this->createProduct();
     $this->assertFalse($this->category->hasProducts());
     $this->assertEquals(0, $this->category->getProductsCount());
     // assert adding
     $this->assertEntity($this->category->addProduct($product1));
     $this->category->addProduct($product2);
     $this->assertCount(2, $this->category->getProducts());
     $this->assertEquals(2, $this->category->getProductsCount());
     $this->assertTrue($this->category->hasProducts());
     // assert removing
     $this->assertEntity($this->category->removeProduct($product1));
     $this->assertCount(1, $this->category->getProducts());
     $this->assertEquals(1, $this->category->getProductsCount());
     $this->assertTrue($this->category->hasProducts());
     // assert product entity
     $products = $this->category->getProducts();
     foreach ($products as $product) {
         $this->assertProductEntity($product);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getProductsCount()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getProductsCount', array());
     return parent::getProductsCount();
 }