execute() public method

public execute ( )
示例#1
0
 /**
  * @test
  * @group postgres
  */
 public function shouldBatchInsertWhenModelHasFetchedRelation()
 {
     //given
     $product1 = new Product(array('name' => 'product1'));
     $product2 = new Product(array('name' => 'product2'));
     $product1->category;
     $inserter = new BatchInserter();
     $inserter->add($product1);
     $inserter->add($product2);
     //when
     $inserter->execute();
     //then
     $this->assertNotNull(Product::where(array('name' => 'product1'))->fetch());
     $this->assertNotNull(Product::where(array('name' => 'product2'))->fetch());
 }