/**
  * @test Collection::add()
  */
 public function testAdd()
 {
     $this->buildEnvironment();
     $this->source['a3'] = $this->source['a1'];
     $this->source['a3']->id = 'a3';
     $this->collection->add($this->source['a1']);
     $this->assertEquals($this->collection->fetch(), $this->source);
 }
 /**
  * Add products to category.
  * 
  * @param Collection $products
  * @return void
  */
 public function attachProducts($products)
 {
     $this->products = array();
     foreach ($products->fetch() as $product) {
         if (array_key_exists($this->id, $product->categories)) {
             $this->products[$product->id] = $product;
         }
     }
 }
Example #3
0
 public function testFetch()
 {
     $res = $this->object->fetch();
     $this->assertType("Page", $res);
     $this->assertEquals($res->name, "Clanek");
 }