public function testJSONRepositoryParseable() { $recipes_repository = new JSONRecipeRepository(); $recipes_repository->setDatasource($this->recipes_json); $recipes_repository->getAll(); $this->assertInstanceOf('\\Illuminate\\Support\\Collection', $recipes_repository->getAll()); // Test first and last ingredients $this->assertEquals($recipes_repository->getAll()->first()->getName(), 'grilled cheese on toast'); $this->assertEquals($recipes_repository->getAll()->last()->getName(), 'salad sandwich'); }
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); }