diff --git a/examples/PizzaTraitTest.php b/examples/PizzaTraitTest.php index 9f217bd..a327f2c 100644 --- a/examples/PizzaTraitTest.php +++ b/examples/PizzaTraitTest.php @@ -32,7 +32,10 @@ class PizzaTraitTest extends \PHPUnit_Framework_TestCase { 'orders' => [ ['size' => 'large', 'toppings' => ['cheese', 'ham']], ['size' => 'medium', 'toppings' => ['cheese']] - ] + ], + 'carts' => [ + // Intentionally empty + ], ]; /** diff --git a/src/DataSet/DataSet.php b/src/DataSet/DataSet.php index 709ce0c..b7cd865 100644 --- a/src/DataSet/DataSet.php +++ b/src/DataSet/DataSet.php @@ -66,7 +66,9 @@ public function dropAllCollections() { */ public function buildCollections() { foreach ($this->fixture as $collection => $data) { - $this->connection->collection($collection)->insertMany($data); + if (!empty($data)) { + $this->connection->collection($collection)->insertMany($data); + } } return $this; }