示例#1
0
 /**
  * Inserts data to the store.
  */
 private function insertData()
 {
     // create some hobbits
     foreach ([['name' => 'Frodo', 'surname' => 'Baggins', 'height' => 140], ['name' => 'Sam', 'surname' => 'Gamgee', 'height' => 132], ['name' => 'Merry', 'surname' => 'Brandybuck', 'height' => 135], ['name' => 'Pippin', 'surname' => 'Took', 'height' => 142]] as $data) {
         $hobbit = $this->repository->createWithData($data);
         $this->repository->save($hobbit);
     }
 }
示例#2
0
 /**
  * Tests inserting data to the store.
  *
  * @depends testConnection
  */
 public function testInsert()
 {
     // make sure the collection is empty first
     $this->assertEmpty($this->repository->find());
     // create some hobbits
     foreach ([['name' => 'Frodo', 'surname' => 'Baggins', 'height' => 140], ['name' => 'Sam', 'surname' => 'Gamgee', 'height' => 132], ['name' => 'Merry', 'surname' => 'Brandybuck', 'height' => 135], ['name' => 'Pippin', 'surname' => 'Took', 'height' => 142]] as $data) {
         $hobbit = $this->repository->createWithData($data);
         $this->repository->save($hobbit);
     }
 }