コード例 #1
0
 public function testCreateNew()
 {
     $product = new Product();
     $product->name = 'This is the title';
     $product->sku = 'UNIQUESKU001';
     $product->short_description = 'This is the body';
     $product->category_id = 1;
     $product->active = true;
     $result = $product->save();
     $this->assertTrue($product->id == 1);
     $this->assertTrue($product->name == 'This is the title');
     $this->assertTrue($product->sku == 'UNIQUESKU001');
     $this->assertTrue($product->short_description == 'This is the body');
     $this->assertTrue($product->category_id == 1);
     $this->assertTrue($product->price == 0);
     $this->assertTrue($product->featured == false);
     $this->assertTrue($product->active == true);
     $this->assertTrue($result == 1);
 }