/** * Load registered parsers from ini file. */ public static function registerParsers() { if (!self::$registered_parsers) { $parsers_ini_file = dirname(__FILE__) . "/" . self::$parsers_ini_file_relpath; self::$registered_parsers = parse_ini_file($parsers_ini_file, true); } }
public function test_white_wedding_cake() { $path_orig = "data/pillsbury_com_white_wedding_cake_with_raspberry_filling_curl.html"; $url = "http://www.pillsbury.com/recipes/white-wedding-cake-with-raspberry-filling/552ae7a5-c451-43fa-9ddc-12b24dbce825/"; $recipe = RecipeParser::parse(file_get_contents($path_orig), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('White Wedding Cake with Raspberry Filling', $recipe->title); $this->assertEquals(0, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('72 servings', $recipe->yield); $this->assertEquals(4, count($recipe->ingredients)); $this->assertEquals('Cake', $recipe->ingredients[0]['name']); $this->assertEquals(4, count($recipe->ingredients[0]['list'])); $this->assertEquals('Frosting', $recipe->ingredients[1]['name']); $this->assertEquals(6, count($recipe->ingredients[1]['list'])); $this->assertEquals('Filling', $recipe->ingredients[2]['name']); $this->assertEquals(1, count($recipe->ingredients[2]['list'])); $this->assertEquals('Supplies needed', $recipe->ingredients[3]['name']); $this->assertEquals(6, count($recipe->ingredients[3]['list'])); $this->assertEquals('1 3/4 cups raspberry filling*', $recipe->ingredients[2]['list'][0]); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(15, count($recipe->instructions[0]['list'])); $this->assertRegExp('/The raspberry filling can be purchased/', $recipe->notes); $this->assertEquals('http://s3.amazonaws.com/gmi-digital-library/134125f3-252e-4a64-b3a3-42e26f8e108f.jpg', $recipe->photo_url); }
public function test_saag_aloo() { $path = "data/bbc_co_uk_bbc_food_s_saag_aloo_with_curl.html"; $url = "http://www.bbc.co.uk/food/recipes/saag_aloo_with_roasted_95304"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Saag aloo with roasted gobi curry', $recipe->title); $this->assertEquals(30, $recipe->time['prep']); $this->assertEquals(60, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('4 servings', $recipe->yield); $this->assertEquals(3, count($recipe->ingredients)); $this->assertEquals('Roasted cauliflower', $recipe->ingredients[0]['name']); $this->assertEquals(4, count($recipe->ingredients[0]['list'])); $this->assertEquals('Vegetable curry', $recipe->ingredients[1]['name']); $this->assertEquals(17, count($recipe->ingredients[1]['list'])); $this->assertEquals('To serve', $recipe->ingredients[2]['name']); $this->assertEquals(1, count($recipe->ingredients[2]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(7, count($recipe->instructions[0]['list'])); $this->assertEquals('', $recipe->photo_url); }
public function test_harvest_crisp() { $path = "data/bonappetit_com_harvest_pear_crisp_with_candied_ginger_curl.html"; $url = "http://www.bonappetit.com/recipes/2009/11/harvest_pear_crisp_with_candied_ginger"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } // Watch for – in serving size $this->assertEquals("8-10 servings", $recipe->yield); }
public function test_rdf_datavocabulary_spec_sub_nodes() { $path = "data/rdf_datavocabulary_spec_sub_nodes.html"; $url = "http://rdf.data-vocabulary.example.com/recipes/spec"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(4, count($recipe->instructions[0]['list'])); $this->assertRegExp("/^Put the cooked and cooled rice/", $recipe->instructions[0]['list'][3]); }
public function test_datavocabulary_spec_instructions_li() { $path = "data/datavocabulary_spec_instructions_li.html"; $recipe = RecipeParser::parse(file_get_contents($path)); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(3, count($recipe->instructions[0]['list'])); $this->assertRegexp("/^Preheat the oven .* cloves intact.\$/", $recipe->instructions[0]['list'][0]); $this->assertRegexp("/^Meanwhile, in a .* soaking liquid.\$/", $recipe->instructions[0]['list'][1]); $this->assertRegexp("/^In a large .* to a bowl.\$/", $recipe->instructions[0]['list'][2]); }
public function test_cookingchanneltv() { $path = "data/cookingchanneltv_com_matt_s_lemon_blueberry_muffins_s_cooking_curl.html"; $url = "http://www.cookingchanneltv.com/recipes/matts-lemon-blueberry-muffins-recipe/index.html"; $recipe = RecipeParser::parse(file_get_contents($path)); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Matt's Lemon Blueberry Muffins", $recipe->title); $this->assertEquals(18, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(6, count($recipe->instructions[0]['list'])); }
public function test_microformat_recipe_instructions_li() { $path = "data/microformat_spec_instructions_li.html"; $url = "http://microformat.example.com/recipes/spec"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(4, count($recipe->instructions[0]['list'])); $this->assertEquals("Beat eggs.", $recipe->instructions[0]['list'][0]); $this->assertEquals("Assemble the pie.", $recipe->instructions[0]['list'][3]); }
public function test_white_peach_sangria() { $path = "data/chow_com_white_peach_sangr_a_chow_com_curl.html"; $url = "http://www.chow.com/recipes/29663-white-peach-sangria"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('White Peach Sangría', $recipe->title); $this->assertEquals('6 drinks', $recipe->yield); $this->assertEquals(7, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions[0]['list'])); $this->assertRegExp('/^.* no getting around .*$/s', $recipe->description); $this->assertStringEndsWith('29663_white_peach_sangria.jpg', $recipe->photo_url); }
public function test_broccoli_cheese_soup() { $path = "data/myrecipes_com_creamy_broccoli_cheese_soup_my_com_curl.html"; $url = "http://www.myrecipes.com/recipe/creamy-broccoli-cheese-soup"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Creamy Broccoli-Cheese Soup", $recipe->title); $this->assertEquals("6 servings (serving size: about 1 cup)", $recipe->yield); $this->assertEquals(45, $recipe->time['total']); $this->assertEquals(10, count($recipe->ingredients[0]['list'])); $this->assertEquals(3, count($recipe->instructions[0]['list'])); $this->assertEquals("Cooking Light", $recipe->credits); }
public function test_lemon_crumb_bars() { $path = "data/cooks_com_lemon_crumb_bars_cooks_com_curl.html"; $url = "http://www.cooks.com/rec/view/0,1910,150169-234207,00.html"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Lemon Crumb Bars", $recipe->title); $this->assertEquals($url, $recipe->url); $this->assertEquals(4, count($recipe->ingredients[0]['list'])); $this->assertEquals(4, count($recipe->ingredients[1]['list'])); $this->assertEquals(1, count($recipe->instructions[0]['list'])); $this->assertEquals(1, count($recipe->instructions[1]['list'])); $this->assertEquals(3, count($recipe->instructions[2]['list'])); }
public function test_slow_cooked_chinese_beef() { $path_orig = "data/bbcgoodfood_com_slow_cooked_chinese_beef_curl.html"; $url = "http://www.bbcgoodfood.com/recipes/96613/slowcooked-chinese-beef"; $recipe = RecipeParser::parse(file_get_contents($path_orig), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Slow-cooked Chinese beef', $recipe->title); $this->assertEquals(0, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(150, $recipe->time['total']); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals(13, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals(2, count($recipe->instructions[0]['list'])); }
public function test_ziti_with_zucchini() { $path = "data/epicurious_com_ziti_with_roasted_zucchini_epicurious_com_curl.html"; $url = "http://www.epicurious.com/recipes/food/views/Ziti-with-Roasted-Zucchini-361191"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Ziti with Roasted Zucchini", $recipe->title); $this->assertEquals($url, $recipe->url); $this->assertEquals("6 main-course servings", $recipe->yield); $this->assertEquals(60, $recipe->time['prep']); $this->assertEquals(120, $recipe->time['total']); $this->assertEquals(8, count($recipe->ingredients[0]['list'])); $this->assertEquals(3, count($recipe->instructions[0]['list'])); $this->assertRegExp("/^Preheat [^\n\r]* minutes.\$/", $recipe->instructions[0]['list'][0]); }
public function test_bigoven_user_submitted() { $path = "data/bigoven_com_banana_bread_bigoven_curl.html"; $url = "http://www.bigoven.com/recipe/334322/Banana-Bread"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Banana Bread", $recipe->title); $this->assertEquals(180, $recipe->time['total']); $this->assertEquals('20 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals(4, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(6, count($recipe->instructions[0]['list'])); }
public function test_whiskey_30() { $path = "data/thedailymeal_com_whiskey_the_daily_meal_curl.html"; $url = "http://www.thedailymeal.com/whiskey-30"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Whiskey 3.0', $recipe->title); $this->assertEquals('akrishba', $recipe->credits); $this->assertEquals('', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(6, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(1, count($recipe->instructions[0]['list'])); }
public function test_cream_puffs() { $path_orig = "data/cookingchanneltv_com_chocolate_cream_puffs_cooking_channel_curl.html"; $url = "http://www.cookingchanneltv.com/recipes/chocolate-cream-puffs.html"; $recipe = RecipeParser::parse(file_get_contents($path_orig), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Chocolate Cream Puffs', $recipe->title); $this->assertEquals(60, $recipe->time['prep']); $this->assertEquals(25, $recipe->time['cook']); $this->assertEquals(85, $recipe->time['total']); $this->assertEquals('36 cream puffs', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals(10, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals(6, count($recipe->instructions[0]['list'])); $this->assertStringEndsWith('cq5dam.web.616.462.jpeg', $recipe->photo_url); }
public function test_sunday_brunch_oysters_rockefeller() { $path_orig = "data/seriouseats_com_oysters_rockefeller_serious_eats_s_curl.html"; $url = "http://www.seriouseats.com/recipes/2011/08/oysters-rockefeller-sunday-brunch-seafood-appetizer.html"; $recipe = RecipeParser::parse(file_get_contents($path_orig), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Oysters Rockefeller', $recipe->title); $this->assertEquals(20, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(35, $recipe->time['total']); $this->assertEquals('4 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(9, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(4, count($recipe->instructions[0]['list'])); }
public function test_recipe_cherry_cobbler_recipes_from_the_kitchn_195824() { $path = "data/thekitchn_com_tart_cherry_crumble_from_the_kitchn_curl.html"; $url = "http://www.thekitchn.com/recipe-cherry-cobbler-recipes-from-the-kitchn-195824"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Tart Cherry Crumble', $recipe->title); $this->assertEquals(2, count($recipe->ingredients)); $this->assertEquals('Cherries', $recipe->ingredients[0]['name']); $this->assertEquals(6, count($recipe->ingredients[0]['list'])); $this->assertEquals('Crumble', $recipe->ingredients[1]['name']); $this->assertEquals(6, count($recipe->ingredients[1]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(5, count($recipe->instructions[0]['list'])); $this->assertEquals('6 servings', $recipe->yield); $this->assertRegExp('/pixstatic\\.com\\/5256c63f697ab06b79002f6e\\._w\\.1500_s\\.fit_\\.jpg/', $recipe->photo_url); }
public function test_paleo_samoas() { $path = "data/elanaspantry_com_paleo_samoas_gluten_free_girl_scout_samoa_cookies_curl.html"; $url = "http://www.elanaspantry.com/paleo-samoas/"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Paleo Samoas', $recipe->title); $this->assertEquals('36 cookies', $recipe->yield); // Multi-section recipe is squeezed into one section. I'm not putting the effort in right now // to split these out. $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(12, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(17, count($recipe->instructions[0]['list'])); $this->assertEquals('http://www.elanaspantry.com/blog/wp-content/uploads/2013/01/Samoras-2-0051.jpg', $recipe->photo_url); }
public function test_simple_atk_parser() { $path = "data/americastestkitchen_com_thick_cut_sweet_potato_fries_america_s_test_kitchen_clipped.html"; $url = "http://www.americastestkitchen.com/recipes/7775-thick-cut-sweet-potato-fries"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertGreaterThan(5, strlen($recipe->title)); $this->assertEquals($url, $recipe->url); #$this->assertEquals(0, $recipe->time['prep']); #$this->assertEquals(0, $recipe->time['cook']); #$this->assertEquals(0, $recipe->time['total']); #$this->assertEquals('', $recipe->yield); $this->assertGreaterThan(0, count($recipe->ingredients)); $this->assertGreaterThan(0, count($recipe->ingredients[0]['list'])); $this->assertGreaterThan(0, count($recipe->instructions)); $this->assertGreaterThan(0, count($recipe->instructions[0]['list'])); $this->assertRegexp('/^http.+cloudfront.+.jpg$/', $recipe->photo_url); }
public function test_southernfood_cinnamon_pound_cake() { $path = "data/southernfood_about_com_cinnamon_pound_cake_curl.html"; $url = "http://southernfood.about.com/od/spicecakerecipes/r/bln255.htm"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Cinnamon Pound Cake", $recipe->title); $this->assertEquals(0, $recipe->time["prep"]); $this->assertEquals(60, $recipe->time["cook"]); $this->assertEquals(60, $recipe->time["total"]); $this->assertEquals("Diana Rattray, About.com", $recipe->credits); $this->assertEquals(2, count($recipe->ingredients)); $this->assertEquals(5, count($recipe->ingredients[0]['list'])); $this->assertEquals(2, count($recipe->ingredients[1]['list'])); $this->assertEquals("Cinnamon-sugar", $recipe->ingredients[1]['name']); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals(3, count($recipe->instructions[0]['list'])); }
public function test_lemon_berry_shortcake() { $path = "data/tasteofhome_com_lemon_berry_shortcake_curl.html"; $url = "http://www.tasteofhome.com/Recipes/Lemon-Berry-Shortcake"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Lemon-Berry Shortcake', $recipe->title); $this->assertEquals(30, $recipe->time['prep']); $this->assertEquals(20, $recipe->time['cook']); $this->assertEquals(50, $recipe->time['total']); $this->assertEquals('8 servings', $recipe->yield); $this->assertEquals(2, count($recipe->ingredients)); $this->assertEquals(11, count($recipe->ingredients[0]['list'])); $this->assertEquals(4, count($recipe->ingredients[1]['list'])); $this->assertEquals('Topping', $recipe->ingredients[1]['name']); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals(3, count($recipe->instructions[0]['list'])); }
public function test_skillet_lasagna() { $path = "data/recipes_sparkpeople_com_skillet_lasagna_by_veggiekitty_sparks_curl.html"; $url = "http://recipes.sparkpeople.com/recipe-detail.asp?recipe=20856"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Skillet Lasagna', $recipe->title); $this->assertEquals(0, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('6 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(16, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(11, count($recipe->instructions[0]['list'])); }
public function test_kale_salad() { $path = "data/foodandwine_com_kale_salad_with_root_vegetables_and_curl.html"; $url = "http://www.foodandwine.com/recipes/kale-salad-with-root-vegetables-and-apple"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Kale Salad with Root Vegetables and Apple', $recipe->title); $this->assertEquals(0, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(50, $recipe->time['total']); $this->assertEquals('8 to 10 servings', $recipe->yield); $this->assertRegExp('/salad can be refrigerated/', $recipe->notes); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals(13, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(3, count($recipe->instructions[0]['list'])); }
public function test_yellow_cake() { $path = "data/realsimple_com_yellow_cake_with_vanilla_frosting_and_curl.html"; $url = "http://www.realsimple.com/food-recipes/browse-all-recipes/yellow-cake-vanilla-frosting-00000000057748/index.html"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Yellow Cake With Vanilla Frosting and White Chocolate Chips', $recipe->title); $this->assertEquals(60, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(150, $recipe->time['total']); $this->assertEquals('12 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals('1 recipe Vanilla Frosting', $recipe->ingredients[0]['list'][9]); $this->assertEquals(11, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals(5, count($recipe->instructions[0]['list'])); $this->assertRegExp("/^Transfer one of the cooled cakes/", $recipe->instructions[0]['list'][4]); }
public function test_carrot_cheesecake() { $path = "data/food_com_carrot_cheesecake_food_com_curl.html"; $url = "http://www.food.com/recipe/carrot-cheesecake-362026"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals("Carrot Cheesecake", $recipe->title); $this->assertEquals($url, $recipe->url); $this->assertEquals("1 cake", $recipe->yield); $this->assertEquals(30, $recipe->time['prep']); $this->assertEquals(60, $recipe->time['cook']); $this->assertEquals(90, $recipe->time['total']); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals(15, count($recipe->ingredients[0]['list'])); $this->assertEquals(2, count($recipe->instructions)); $this->assertEquals(3, count($recipe->instructions[0]['list'])); $this->assertEquals(4, count($recipe->instructions[1]['list'])); $this->assertEquals('', $recipe->photo_url); }
public function test_tofu_amaranth_salad_recipe() { $path = "data/101cookbooks_com_tofu_amaranth_salad_cookbooks_curl.html"; $url = "http://www.101cookbooks.com/archives/tofu-amaranth-salad-recipe.html"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Tofu Amaranth Salad', $recipe->title); $this->assertEquals(10, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('4 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(12, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(1, count($recipe->instructions[0]['list'])); $this->assertEquals('http://www.101cookbooks.com/mt-static/images/food/tofu_amaranth_salad_recipe.jpg', $recipe->photo_url); }
public function test_wild_maine_blueberry_cobbler_recipe_2278_aspx() { $path = "data/cooking_com_wild_maine_blueberry_cobbler_cooking_com_curl.html"; $url = "http://www.cooking.com/recipes-and-more/recipes/wild-maine-blueberry-cobbler-recipe-2278.aspx"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Wild Maine Blueberry Cobbler', $recipe->title); $this->assertEquals(46, $recipe->time['prep']); #$this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('6 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(11, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(5, count($recipe->instructions[0]['list'])); $this->assertEquals("", $recipe->photo_url); }
public function test_sweet_cinnamon_scones() { $path = "data/thepioneerwoman_com_sweet_cinnamon_scones_the_pioneer_woman_curl.html"; $url = "http://thepioneerwoman.com/cooking/2011/03/sweet-cinnamon-scones/"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Sweet Cinnamon Scones', $recipe->title); $this->assertEquals(20, $recipe->time['prep']); $this->assertEquals(25, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('8 servings', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(13, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(5, count($recipe->instructions[0]['list'])); $this->assertEquals('http://tastykitchen.com/recipes/files/2011/03/5525020534_a195290297_o-420x280.jpg', $recipe->photo_url); }
public function test_light_and_sweet_dessert_creamy_raspberry_cheesecake_bars() { $path = "data/12tomatoes_com_light_and_sweet_dessert_creamy_raspberry_curl.html"; $url = "http://12tomatoes.com/2015/04/light-and-sweet-dessert-creamy-raspberry-cheesecake-bars.html"; $recipe = RecipeParser::parse(file_get_contents($path), $url); if (isset($_SERVER['VERBOSE'])) { print_r($recipe); } $this->assertEquals('Raspberry Cheesecake Bars', $recipe->title); $this->assertEquals('', $recipe->credits); $this->assertEquals(0, $recipe->time['prep']); $this->assertEquals(0, $recipe->time['cook']); $this->assertEquals(0, $recipe->time['total']); $this->assertEquals('2-3 dozen squares', $recipe->yield); $this->assertEquals(1, count($recipe->ingredients)); $this->assertEquals('', $recipe->ingredients[0]['name']); $this->assertEquals(11, count($recipe->ingredients[0]['list'])); $this->assertEquals(1, count($recipe->instructions)); $this->assertEquals('', $recipe->instructions[0]['name']); $this->assertEquals(10, count($recipe->instructions[0]['list'])); $this->assertEquals('http://s3.amazonaws.com/studio-me/system/photos/photos/000/813/291/original/19555409_l.jpg', $recipe->photo_url); }