Exemplo n.º 1
0
 public function setUp()
 {
     parent::setup();
     $ingredient_repository = new CSVIngredientRepository();
     $recipe_repository = new JSONRecipeRepository();
     $ingredient_repository->setDatasource(app_path() . '/tests/data/ingredients.csv');
     $recipe_repository->setDatasource(app_path() . '/tests/data/recipes.json');
     App::bind('RecipeFinder\\Ingredient\\IngredientRepositoryInterface', 'RecipeFinder\\Ingredient\\CSVIngredientRepository');
     App::bind('RecipeFinder\\Recipe\\RecipeRepositoryInterface', 'RecipeFinder\\Recipe\\JSONRecipeRepository');
     $this->recipe_finder = new RecipeFinder($recipe_repository, $ingredient_repository);
 }
Exemplo n.º 2
0
 public function testCSVIngredientsRepositoryParseable()
 {
     $ingredient_repository = new CSVIngredientRepository();
     $ingredient_repository->setDatasource($this->ingredients_csv);
     $ingredient_repository->getAll();
     $this->assertInstanceOf('\\Illuminate\\Support\\Collection', $ingredient_repository->getAll());
     // Test first and last ingredients
     $this->assertEquals($ingredient_repository->getAll()->first()->getName(), 'bread');
     $this->assertEquals($ingredient_repository->getAll()->last()->getName(), 'mixed salad');
 }