Ejemplo n.º 1
0
 public function testParseWillThrowIfTheFixtureDoesntReturnAnArray()
 {
     try {
         $this->parser->parse($file = __DIR__ . '/../../../support/fixtures/invalid.php');
     } catch (UnexpectedValueException $e) {
         $this->assertEquals("Included file \"{$file}\" must return an array of data", $e->getMessage());
     }
 }
Ejemplo n.º 2
0
 public function testIncludeFiles()
 {
     $data = $this->parser->parse(__DIR__ . '/../../../support/fixtures/include.php');
     $expectedData = ['Nelmio\\Alice\\fixtures\\Product' => ['product_base (template)' => ['status' => 'in_stock', 'site' => '<word()>', 'changed' => 'n', 'locked' => '<word()>', 'cancelled' => '<word()>', 'canBuy' => 'y', 'package' => 'n', 'price' => '<randomFloat()>', 'amount' => 1, 'markDeleted' => '<word()>', 'paid' => 'y'], 'product1' => ['amount' => 45, 'paid' => 'n', 'user' => '@user0'], 'product0' => ['changed' => 'y', 'user' => '@user1']], 'Nelmio\\Alice\\fixtures\\Shop' => ['shop2' => ['domain' => 'amazon.com'], 'shop1' => ['domain' => 'ebay.com']], 'Nelmio\\Alice\\fixtures\\User' => ['user_base (template)' => ['email' => '<email()>']]];
     $this->assertEquals($expectedData, $data);
 }