From 39e21798078e9acfb0bd78ad187fd1e00da6c874 Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy <gabor@hojtsy.hu> Date: Mon, 5 Feb 2018 13:31:29 +0100 Subject: [PATCH] =?UTF-8?q?Issue=20#2940362=20by=20Eli-T,=20kjay,=20navnee?= =?UTF-8?q?t0693,=20markconroy,=20larowlan,=20G=C3=A1bor=20Hojtsy:=20Move?= =?UTF-8?q?=20recipe=20instruction=20out=20of=20csv=20file=20in=20to=20the?= =?UTF-8?q?ir=20own=20text=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recipe_instructions/.htaccess | 11 +++++++++++ .../chocolate-brownie-umami.html | 7 +++++++ .../mediterranean-quiche-umami.html | 7 +++++++ .../recipe_instructions/pizza-umami.html | 7 +++++++ .../thai-green-curry-umami.html | 6 ++++++ .../veggie-pasta-bake-umami.html | 8 ++++++++ .../victoria-sponge-umami.html | 8 ++++++++ .../watercress-soup-umami.html | 7 +++++++ .../default_content/recipes.csv | 16 ++++++++-------- .../demo_umami_content/src/InstallHelper.php | 6 +++++- .../Functional/UninstallDefaultContentTest.php | 2 ++ .../src/Functional/DemoUmamiProfileTest.php | 11 +++++++++++ 12 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/.htaccess create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/chocolate-brownie-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/mediterranean-quiche-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/pizza-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/thai-green-curry-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/veggie-pasta-bake-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/victoria-sponge-umami.html create mode 100644 core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/watercress-soup-umami.html diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/.htaccess b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/.htaccess new file mode 100644 index 000000000000..bdcdd2f5c882 --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/.htaccess @@ -0,0 +1,11 @@ +# Deny all requests from Apache 2.4+. +<IfModule mod_authz_core.c> + Require all denied +</IfModule> + +# Deny all requests from Apache 2.0-2.2. +<IfModule !mod_authz_core.c> + Deny from all +</IfModule> +# Turn off all options we don't need. +Options -Indexes -ExecCGI -Includes -MultiViews diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/chocolate-brownie-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/chocolate-brownie-umami.html new file mode 100644 index 000000000000..d4a47f8cc382 --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/chocolate-brownie-umami.html @@ -0,0 +1,7 @@ +<ol> + <li>Preheat the oven to 180C and grease a 8 inch cake tin.</li> + <li>Sift the flour and cocoa powder into a bowl and add the sugar and salt.</li> + <li>Add the oil, a little at time, mixing well to avoid lumps. Add the soy milk and vanilla extract and mix thoroughly.</li> + <li>Gently pour into the cake tin and spread out until even. Bake for about 15 minutes and check with a knife (the knife should come out clean when inserted into the brownies 2cm from the edge).</li> + <li>Allow to cool in the tin for a few minutes before cooling on a wire rack.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/mediterranean-quiche-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/mediterranean-quiche-umami.html new file mode 100644 index 000000000000..10d305d82a1b --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/mediterranean-quiche-umami.html @@ -0,0 +1,7 @@ +<ol> + <li>Preheat the oven to 200C. Starting with the pastry; rub the flour and butter together in a bowl until crumbling like breadcrumbs. Add water, a little at a time, until it forms a dough.</li> + <li>Roll out the pastry on a floured board and gently spread over your tin. Place in the fridge for 20 minutes before blind baking for a further 10.</li> + <li>Whilst the pastry is cooling, gently cook the onions, garlic and courgette.</li> + <li>In a large bowl, add the soya milk, half the parmesan, and the eggs. Gently mix.</li> + <li>Once the pastry is cooked, spread the onions, garlic and sun dried tomatoes over the base and pour the eggs mix over. Sprinkle the remaining parmesan and careful lay the feta over the top. Bake for 30 minutes or until golden brown.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/pizza-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/pizza-umami.html new file mode 100644 index 000000000000..2c5d19d40193 --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/pizza-umami.html @@ -0,0 +1,7 @@ +<ol> + <li>Preheat the oven to 220C. Mix the some of the milk and water in a jug, and add the yeast and sugar, then set aside.</li> + <li>In a bowl, mix the flour, salt and oil. Slowly add the liquid from the jug and form into a dough.</li> + <li>Break the dough in half and shape into two pizza bases. Set aside for about 15 minutes, whilst making the topping.</li> + <li>Spread the tomato puree over the pizza bases, chop the basil and rocket and sprinkle over the tomato. Lay the chopped Parma ham on top and add thick slices of mozzarella across the pizza.</li> + <li>Cook in the oven directly on the top shelf (with a tray underneath) for 10-12 minutes until the mozzarella is bubbling. Season with salt and pepper and serve.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/thai-green-curry-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/thai-green-curry-umami.html new file mode 100644 index 000000000000..b275bd425505 --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/thai-green-curry-umami.html @@ -0,0 +1,6 @@ +<ol> + <li>In a large wok, brown the chicken until golden, then turn the heat down and gently cook the garlic. Add the chopped green beans and stir.</li> + <li>Add the coconut milk, green curry paste and fish sauce. Mix well and slowly simmer.</li> + <li>Add the chopped mushrooms and simmer until the chicken (or tofu) is cooked.</li> + <li>Serve with jasmine rice and a sprinkle of coriander.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/veggie-pasta-bake-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/veggie-pasta-bake-umami.html new file mode 100644 index 000000000000..7c4b96e7ed82 --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/veggie-pasta-bake-umami.html @@ -0,0 +1,8 @@ +<ol> + <li>In a large pan, boil the pasta in plenty of water until cooked.</li> + <li>Whilst the pasta is cooking, gently fry the onions and garlic in a little oil until soft and the onion looks clear.</li> + <li>Add the vegetarian sausages. Once browned, remove and chop into chunky bites.</li> + <li>Pop the sausages back into the pan and add the tomatoes, sugar, pesto and sun dried tomatoes. Season to taste. Simmer until most of the water from the chopped tomatoes has gone.</li> + <li>Drain the pasta and add to the pan with the sausages and tomatoes. Stir in half of the cheddar and transfer to a shallow dish. Sprinkle with the rest of the cheddar and dot the sliced mozzarella over the top.</li> + <li>Grill for 10 minutes or the cheese as melted and started to brown. Serve with basil leaves.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/victoria-sponge-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/victoria-sponge-umami.html new file mode 100644 index 000000000000..31859201b61a --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/victoria-sponge-umami.html @@ -0,0 +1,8 @@ +<ol> + <li>Preheat the oven to 180C and grease two 8 inch cake tins.</li> + <li>In a large bowl, mix the butter and sugar together, then add the eggs, flour and baking powder.</li> + <li>Spread the mix evenly between the 2 cake tins.</li> + <li>Place both tins in the middle of the preheated oven for 20 minutes, before checking with a knife. When the knife comes out clean, its ready!</li> + <li>Allow to cool in the tins before moving them onto a cooling rack.</li> + <li>Add the jam, stack, dust with icing sugar and serve with a big dollop of cream. Enjoy!</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/watercress-soup-umami.html b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/watercress-soup-umami.html new file mode 100644 index 000000000000..c7a803d2d1ee --- /dev/null +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipe_instructions/watercress-soup-umami.html @@ -0,0 +1,7 @@ +<ol> + <li>Prepare the vegetables by peeling and chopping the potatoes, finely chopping the onions, leeks and garlic.</li> + <li>Heat a little oil in a pan and add the chopped vegetables, gently cooking them for about 5 minutes.</li> + <li>Add the vegetable stock to the same pan and turn up the heat until simmering, adding the watercress after about 10 minutes. Cook until all the vegetables are soft and easily mashed.</li> + <li>Liquidize the soup either with a hand blender or in a mixer, until smooth.</li> + <li>If the soup has cooled too much whilst being liquidized, stir in the crème fraîche and reheat before serving (otherwise serve straight away). Season to taste.</li> +</ol> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipes.csv b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipes.csv index 4b0c5fd6fd52..64c479c7dc00 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipes.csv +++ b/core/profiles/demo_umami/modules/demo_umami_content/default_content/recipes.csv @@ -1,8 +1,8 @@ -title,image,alt,summary,author,recipe_category,preparation_time,cooking_time,total_time,difficulty,ingredients,recipe_instruction,number_of_servings,tags,slug -Deep mediterranean quiche,mediterranean-quiche-umami.jpg,"A delicious deep layered Mediterranean quiche, sliced.",An Italian inspired quiche with sun dried tomatoes and courgette. A perfect light meal for a summer's day.,Umami,Main course,40,30,70,medium,"For the pastry:,280g plain flour,140g butter,Cold water,For the filling:,1 onion (chopped),2 cloves of garlic (chopped),Half courgette (chopped),450ml soya milk,500g grated parmesan,2 eggs,200g sun dried tomatoes,100g feta","<ol><li>Preheat the oven to 200C. Starting with the pastry; rub the flour and butter together in a bowl until crumbling like breadcrumbs. Add water, a little at a time, until it forms a dough.</li><li>Roll out the pastry on a floured board and gently spread over your tin. Place in the fridge for 20 minutes before blind baking for a further 10.</li><li>Whilst the pastry is cooling, gently cook the onions, garlic and courgette.</li><li>In a large bowl, add the soya milk, half the parmesan, and the eggs. Gently mix.</li><li>Once the pastry is cooked, spread the onions, garlic and sun dried tomatoes over the base and pour the eggs mix over. Sprinkle the remaining parmesan and careful lay the feta over the top. Bake for 30 minutes or until golden brown.</li></ol>",8,"Pastry,Egg",recipes/deep-mediterranean-quiche -Vegan chocolate brownies,chocolate-brownie-umami.jpg,A plate with a vegan chocolate brownie covered in dark vegan chocolate,These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!,Umami,Snack,20,20,40,,"170g self-raising flour, 3 tablespoons of cocoa powder, 170g of caster sugar, 5 tablespoons of vegetable oil, 1 teaspoon vanilla extract, A pinch of salt, 230ml soy milk","<ol><li>Preheat the oven to 180C and grease a 8 inch cake tin.</li><li>Sift the flour and cocoa powder into a bowl and add the sugar and salt. </li><li>Add the oil, a little at time, mixing well to avoid lumps. Add the soy milk and vanilla extract and mix thoroughly.</li><li>Gently pour into the cake tin and spread out until even. Bake for about 15 minutes and check with a knife (the knife should come out clean when inserted into the brownies 2cm from the edge).</li><li>Allow to cool in the tin for a few minutes before cooling on a wire rack.</li></ol>",8,,recipes/vegan-chocolate-brownies -Super easy vegetarian pasta bake,veggie-pasta-bake-umami.jpg,Cheesy pasta dish with vegetarian sausages and topped with Mozzarella,A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.,Umami,Main course,5,20,25,easy,"400g wholewheat pasta, 1 chopped onion, 2 cloves of garlic, 1 pack of vegetarian sausages, 1 tin of chopped tomatoes, 50g of sliced sun dried tomatoes, Pinch of sugar, 3 tablespoons of red pesto, 50g cheddar cheese, Basil or mixed herbs, 100g mozzarella","<ol><li>In a large pan, boil the pasta in plenty of water until cooked.</li><li>Whilst the pasta is cooking, gently fry the onions and garlic in a little oil until soft and the onion looks clear.</li><li>Add the vegetarian sausages. Once browned, remove and chop into chunky bites.</li><li>Pop the sausages back into the pan and add the tomatoes, sugar, pesto and sun dried tomatoes. Season to taste. Simmer until most of the water from the chopped tomatoes has gone.</li><li>Drain the pasta and add to the pan with the sausages and tomatoes. Stir in half of the cheddar and transfer to a shallow dish. Sprinkle with the rest of the cheddar and dot the sliced mozzarella over the top.</li><li>Grill for 10 minutes or the cheese as melted and started to brown. Serve with basil leaves.</li></ol>",4,"Vegetarian,Pasta,Baked",recipes/super-easy-vegetarian-pasta-bake -Watercress soup,watercress-soup-umami.jpg,Light and simply presented watercress soup with a sprig of coriander to finish,"A wonderfully simple and light soup, making the most of seasonal, local produce. ",Umami,Starter,10,20,30,easy,"3 bunches of watercress,3 potatoes,3 onions,2 leeks,800ml stock,5 tablespoons of crème fraîche","<ol><li>Prepare the vegetables by peeling and chopping the potatoes, finely chopping the onions, leeks and garlic.</li><li>Heat a little oil in a pan and add the chopped vegetables, gently cooking them for about 5 minutes.</li><li>Add the vegetable stock to the same pan and turn up the heat until simmering, adding the watercress after about 10 minutes. Cook until all the vegetables are soft and easily mashed.</li><li>Liquidize the soup either with a hand blender or in a mixer, until smooth.</li><li>If the soup has cooled too much whilst being liquidized, stir in the crème fraîche and reheat before serving (otherwise serve straight away). Season to taste.</li></ol>",4,"Soup,Vegetarian",recipes/watercress-soup -Victoria sponge cake,victoria-sponge-umami.jpg,"A classic, uncut Victoria sponge with a deep filling of butter cream and jam","A traditional Victoria sponge cake, perfect for any afternoon with a cup of tea.",Umami,Desert,20,20,40,easy,"225g butter or margarine,225g caster sugar,225g self-raising flour,4 eggs,1 level teaspoon of baking powder,3 tablespoons of jam for the filling,Icing sugar to dust the top,Cream to serve","<ol><li>Preheat the oven to 180C and grease two 8 inch cake tins.</li><li>In a large bowl, mix the butter and sugar together, then add the eggs, flour and baking powder.</li><li>Spread the mix evenly between the 2 cake tins.</li><li>Place both tins in the middle of the preheated oven for 20 minutes, before checking with a knife. When the knife comes out clean, its ready!</li><li>Allow to cool in the tins before moving them onto a cooling rack.</li><li>Add the jam, stack, dust with icing sugar and serve with a big dollop of cream. Enjoy!</li></ol>",10,Cake,recipes/victoria-sponge-cake -Gluten free pizza,pizza-umami.jpg,"Olives, basil and mozzarella top a gluten free pizza base","A gorgeous and simple gluten free pizza, with deliciously indulgent mozzeralla and Parma ham. Can easily be vegetarian by leaving out the ham.",Umami,Main course,15,15,30,,"400g gluten free flour, 125ml warm water, 125ml milk, 1 sachet of dried yeast, 2 teaspoons of sugar, 1 teaspoons of salt, 2 tablespoons olive oil, 4 tablespoons of tomato puree, 1 clove of garlic, Some fresh basil, 200g of mozzarella, 100g rocket, 5 slices of Parma ham","<ol><li>Preheat the oven to 220C. Mix the some of the milk and water in a jug, and add the yeast and sugar, then set aside.</li><li>In a bowl, mix the flour, salt and oil. Slowly add the liquid from the jug and form into a dough. </li><li>Break the dough in half and shape into two pizza bases. Set aside for about 15 minutes, whilst making the topping.</li><li>Spread the tomato puree over the pizza bases, chop the basil and rocket and sprinkle over the tomato. Lay the chopped Parma ham on top and add thick slices of mozzarella across the pizza.</li><li>Cook in the oven directly on the top shelf (with a tray underneath) for 10-12 minutes until the mozzarella is bubbling. Season with salt and pepper and serve.</li></ol>",4,,recipes/gluten-free-pizza -Thai green curry,thai-green-curry-umami.jpg,"A traditional bowl of creamy, aromatic Thai green curry with chunks of chicken and a small bowl of jasmine rice.",A quick and easy version of the classic Thai green curry. Perfect for a midweek meal!,Umami,Main course,10,15,25,,"400g coconut milk, 400g chicken or tofu, 1 tablespoon of Thai green curry paste, 1 clove of garlic, 2 teaspoons of fish sauce, 400g mushrooms, 200g green beans, Fresh coriander leaves, Jasmine rice","<ol><li>In a large wok, brown the chicken until golden, then turn the heat down and gently cook the garlic. Add the chopped green beans and stir.</li><li>Add the coconut milk, green curry paste and fish sauce. Mix well and slowly simmer.</li><li>Add the chopped mushrooms and simmer until the chicken (or tofu) is cooked.</li><li>Serve with jasmine rice and a sprinkle of coriander.</li></ol>",4,,recipes/thai-green-curry \ No newline at end of file +title,image,alt,summary,author,recipe_category,preparation_time,cooking_time,total_time,difficulty,ingredients,recipe_instruction,number_of_servings,tags,slug +Deep mediterranean quiche,mediterranean-quiche-umami.jpg,"A delicious deep layered Mediterranean quiche, sliced.",An Italian inspired quiche with sun dried tomatoes and courgette. A perfect light meal for a summer's day.,Umami,Main course,40,30,70,medium,"For the pastry:,280g plain flour,140g butter,Cold water,For the filling:,1 onion (chopped),2 cloves of garlic (chopped),Half courgette (chopped),450ml soya milk,500g grated parmesan,2 eggs,200g sun dried tomatoes,100g feta",mediterranean-quiche-umami.html,8,"Pastry,Egg",recipes/deep-mediterranean-quiche +Vegan chocolate brownies,chocolate-brownie-umami.jpg,A plate with a vegan chocolate brownie covered in dark vegan chocolate,These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!,Umami,Snack,20,20,40,,"170g self-raising flour, 3 tablespoons of cocoa powder, 170g of caster sugar, 5 tablespoons of vegetable oil, 1 teaspoon vanilla extract, A pinch of salt, 230ml soy milk",chocolate-brownie-umami.html,8,,recipes/vegan-chocolate-brownies +Super easy vegetarian pasta bake,veggie-pasta-bake-umami.jpg,Cheesy pasta dish with vegetarian sausages and topped with Mozzarella,A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.,Umami,Main course,5,20,25,easy,"400g wholewheat pasta, 1 chopped onion, 2 cloves of garlic, 1 pack of vegetarian sausages, 1 tin of chopped tomatoes, 50g of sliced sun dried tomatoes, Pinch of sugar, 3 tablespoons of red pesto, 50g cheddar cheese, Basil or mixed herbs, 100g mozzarella",veggie-pasta-bake-umami.html,4,"Vegetarian,Pasta,Baked",recipes/super-easy-vegetarian-pasta-bake +Watercress soup,watercress-soup-umami.jpg,Light and simply presented watercress soup with a sprig of coriander to finish,"A wonderfully simple and light soup, making the most of seasonal, local produce. ",Umami,Starter,10,20,30,easy,"3 bunches of watercress,3 potatoes,3 onions,2 leeks,800ml stock,5 tablespoons of crème fraîche",watercress-soup-umami.html,4,"Soup,Vegetarian",recipes/watercress-soup +Victoria sponge cake,victoria-sponge-umami.jpg,"A classic, uncut Victoria sponge with a deep filling of butter cream and jam","A traditional Victoria sponge cake, perfect for any afternoon with a cup of tea.",Umami,Desert,20,20,40,easy,"225g butter or margarine,225g caster sugar,225g self-raising flour,4 eggs,1 level teaspoon of baking powder,3 tablespoons of jam for the filling,Icing sugar to dust the top,Cream to serve",victoria-sponge-umami.html,10,Cake,recipes/victoria-sponge-cake +Gluten free pizza,pizza-umami.jpg,"Olives, basil and mozzarella top a gluten free pizza base","A gorgeous and simple gluten free pizza, with deliciously indulgent mozzeralla and Parma ham. Can easily be vegetarian by leaving out the ham.",Umami,Main course,15,15,30,,"400g gluten free flour, 125ml warm water, 125ml milk, 1 sachet of dried yeast, 2 teaspoons of sugar, 1 teaspoons of salt, 2 tablespoons olive oil, 4 tablespoons of tomato puree, 1 clove of garlic, Some fresh basil, 200g of mozzarella, 100g rocket, 5 slices of Parma ham",pizza-umami.html,4,,recipes/gluten-free-pizza +Thai green curry,thai-green-curry-umami.jpg,"A traditional bowl of creamy, aromatic Thai green curry with chunks of chicken and a small bowl of jasmine rice.",A quick and easy version of the classic Thai green curry. Perfect for a midweek meal!,Umami,Main course,10,15,25,,"400g coconut milk, 400g chicken or tofu, 1 tablespoon of Thai green curry paste, 1 clove of garlic, 2 teaspoons of fish sauce, 400g mushrooms, 200g green beans, Fresh coriander leaves, Jasmine rice",thai-green-curry-umami.html,4,,recipes/thai-green-curry diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index cf91059414c8..6c7b7af82c7a 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -219,7 +219,11 @@ protected function importRecipes() { } // Set field_recipe_instruction Field. if (!empty($data['recipe_instruction'])) { - $values['field_recipe_instruction'] = [['value' => $data['recipe_instruction'], 'format' => 'basic_html']]; + $recipe_instruction_path = $module_path . '/default_content/recipe_instructions/' . $data['recipe_instruction']; + $recipe_instructions = file_get_contents($recipe_instruction_path); + if ($recipe_instructions !== FALSE) { + $values['field_recipe_instruction'] = [['value' => $recipe_instructions, 'format' => 'basic_html']]; + } } // Set field_tags if exists. if (!empty($data['tags'])) { diff --git a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php index ef955bca3011..a986b41c228a 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php @@ -89,6 +89,8 @@ protected function assertRecipesImported(EntityStorageInterface $node_storage) { $this->assertGreaterThan(0, $count); $nodes = $node_storage->loadByProperties(['title' => 'Gluten free pizza']); $this->assertCount(1, $nodes); + $node = reset($nodes); + $this->assertContains('Mix the some of the milk and water in a jug', $node->field_recipe_instruction->value); } /** diff --git a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php index ae0646a30caf..83f588ca3029 100644 --- a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php +++ b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php @@ -174,4 +174,15 @@ public function testAccessDeniedToSampleImages() { $this->assertSession()->statusCodeEquals(403); } + /** + * Tests that sample recipes are not accessible to the webserver. + */ + public function testAccessDeniedToSampleRecipes() { + $file_name = 'chocolate-brownie-umami.html'; + $file_path = '/' . drupal_get_path('module', 'demo_umami_content') . '/default_content/recipe_instructions/' . $file_name; + $this->assertTrue(file_exists(DRUPAL_ROOT . $file_path)); + $this->drupalGet($file_path); + $this->assertSession()->statusCodeEquals(403); + } + } -- GitLab