sarga/tests/functional/CartRule/CartRuleCopyCest.php

61 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace Tests\Functional\CartRule;
use FunctionalTester;
bagisto master backmerge (#26) * introduce cronjob to automatically deactivate expired events * remove irrelevant code * extend cart rule validation with search in cart item additional * add additional to all languages * add ValidatorCest * add ValidatorCest * Fixed case sensitivity typo in Bundle class * Update 503.blade.php * Added customer group price * Fixed bundle type class compatablity issue * Refactor some changes Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> * add english translation to foreign languages * fix compatibility issue to AbstractType * check if product_id exists * make a prefix to the copied cart rule ('copy of XXX') and properly save related channels and customer groups after replication * add table, lists, link and hr functionality to editor * Issue #3164 fixed * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Issue #3113 fixed * fix tiny issues due to code guidelines * add default value for search term * fix typo * Fixed typo in customer group price migration * Issue #3171 fixed * Issue #3070 fixed * minified jquery-ez-plus file * Issue #3160 fixed Co-authored-by: Shubham Mehrotra <shubh0896m@gmail.com> Co-authored-by: Matt April <matthew.japril@gmail.com> Co-authored-by: bhumikaisarani <63963172+bhumikaisarani@users.noreply.github.com> Co-authored-by: Jitendra Singh <39991107+jitendra-webkul@users.noreply.github.com> Co-authored-by: Pranshu Tomar <pranshutomar@Pranshus-MacBook-Air.local> Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> Co-authored-by: Herbert Maschke <thyseus@pm.me> Co-authored-by: phillipmohr <phillip.mohr@sellerboost.de> Co-authored-by: İlyas Okay <ilyasokay@hotmail.com> Co-authored-by: Florian Bosdorff <florian.bosdorff@haendlerbund.de> Co-authored-by: phillipcodes <57101430+phillipcodes@users.noreply.github.com>
2020-06-09 05:55:56 +00:00
use Illuminate\Support\Facades\DB;
use Webkul\CartRule\Models\CartRule;
class CartRuleCopyCest
{
public function testCartRuleCopy(FunctionalTester $I)
{
$I->loginAsAdmin();
$original = $I->have(CartRule::class, [
'status' => 1,
]);
bagisto master backmerge (#26) * introduce cronjob to automatically deactivate expired events * remove irrelevant code * extend cart rule validation with search in cart item additional * add additional to all languages * add ValidatorCest * add ValidatorCest * Fixed case sensitivity typo in Bundle class * Update 503.blade.php * Added customer group price * Fixed bundle type class compatablity issue * Refactor some changes Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> * add english translation to foreign languages * fix compatibility issue to AbstractType * check if product_id exists * make a prefix to the copied cart rule ('copy of XXX') and properly save related channels and customer groups after replication * add table, lists, link and hr functionality to editor * Issue #3164 fixed * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Issue #3113 fixed * fix tiny issues due to code guidelines * add default value for search term * fix typo * Fixed typo in customer group price migration * Issue #3171 fixed * Issue #3070 fixed * minified jquery-ez-plus file * Issue #3160 fixed Co-authored-by: Shubham Mehrotra <shubh0896m@gmail.com> Co-authored-by: Matt April <matthew.japril@gmail.com> Co-authored-by: bhumikaisarani <63963172+bhumikaisarani@users.noreply.github.com> Co-authored-by: Jitendra Singh <39991107+jitendra-webkul@users.noreply.github.com> Co-authored-by: Pranshu Tomar <pranshutomar@Pranshus-MacBook-Air.local> Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> Co-authored-by: Herbert Maschke <thyseus@pm.me> Co-authored-by: phillipmohr <phillip.mohr@sellerboost.de> Co-authored-by: İlyas Okay <ilyasokay@hotmail.com> Co-authored-by: Florian Bosdorff <florian.bosdorff@haendlerbund.de> Co-authored-by: phillipcodes <57101430+phillipcodes@users.noreply.github.com>
2020-06-09 05:55:56 +00:00
DB::table('cart_rule_channels')->insert([
'cart_rule_id' => $original->id,
'channel_id' => 1,
]);
DB::table('cart_rule_customer_groups')->insert([
'cart_rule_id' => $original->id,
'customer_group_id' => 1,
]);
$count = count(CartRule::all());
$I->amOnAdminRoute('admin.cart-rules.copy', ['id' => $original->id]);
$I->seeRecord(CartRule::class, [
'id' => $original->id + 1,
'status' => 0,
bagisto master backmerge (#26) * introduce cronjob to automatically deactivate expired events * remove irrelevant code * extend cart rule validation with search in cart item additional * add additional to all languages * add ValidatorCest * add ValidatorCest * Fixed case sensitivity typo in Bundle class * Update 503.blade.php * Added customer group price * Fixed bundle type class compatablity issue * Refactor some changes Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> * add english translation to foreign languages * fix compatibility issue to AbstractType * check if product_id exists * make a prefix to the copied cart rule ('copy of XXX') and properly save related channels and customer groups after replication * add table, lists, link and hr functionality to editor * Issue #3164 fixed * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Issue #3113 fixed * fix tiny issues due to code guidelines * add default value for search term * fix typo * Fixed typo in customer group price migration * Issue #3171 fixed * Issue #3070 fixed * minified jquery-ez-plus file * Issue #3160 fixed Co-authored-by: Shubham Mehrotra <shubh0896m@gmail.com> Co-authored-by: Matt April <matthew.japril@gmail.com> Co-authored-by: bhumikaisarani <63963172+bhumikaisarani@users.noreply.github.com> Co-authored-by: Jitendra Singh <39991107+jitendra-webkul@users.noreply.github.com> Co-authored-by: Pranshu Tomar <pranshutomar@Pranshus-MacBook-Air.local> Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> Co-authored-by: Herbert Maschke <thyseus@pm.me> Co-authored-by: phillipmohr <phillip.mohr@sellerboost.de> Co-authored-by: İlyas Okay <ilyasokay@hotmail.com> Co-authored-by: Florian Bosdorff <florian.bosdorff@haendlerbund.de> Co-authored-by: phillipcodes <57101430+phillipcodes@users.noreply.github.com>
2020-06-09 05:55:56 +00:00
'name' => 'Copy of ' . $original->name,
]);
$I->assertCount($count + 1, CartRule::all());
bagisto master backmerge (#26) * introduce cronjob to automatically deactivate expired events * remove irrelevant code * extend cart rule validation with search in cart item additional * add additional to all languages * add ValidatorCest * add ValidatorCest * Fixed case sensitivity typo in Bundle class * Update 503.blade.php * Added customer group price * Fixed bundle type class compatablity issue * Refactor some changes Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> * add english translation to foreign languages * fix compatibility issue to AbstractType * check if product_id exists * make a prefix to the copied cart rule ('copy of XXX') and properly save related channels and customer groups after replication * add table, lists, link and hr functionality to editor * Issue #3164 fixed * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Issue #3113 fixed * fix tiny issues due to code guidelines * add default value for search term * fix typo * Fixed typo in customer group price migration * Issue #3171 fixed * Issue #3070 fixed * minified jquery-ez-plus file * Issue #3160 fixed Co-authored-by: Shubham Mehrotra <shubh0896m@gmail.com> Co-authored-by: Matt April <matthew.japril@gmail.com> Co-authored-by: bhumikaisarani <63963172+bhumikaisarani@users.noreply.github.com> Co-authored-by: Jitendra Singh <39991107+jitendra-webkul@users.noreply.github.com> Co-authored-by: Pranshu Tomar <pranshutomar@Pranshus-MacBook-Air.local> Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> Co-authored-by: Herbert Maschke <thyseus@pm.me> Co-authored-by: phillipmohr <phillip.mohr@sellerboost.de> Co-authored-by: İlyas Okay <ilyasokay@hotmail.com> Co-authored-by: Florian Bosdorff <florian.bosdorff@haendlerbund.de> Co-authored-by: phillipcodes <57101430+phillipcodes@users.noreply.github.com>
2020-06-09 05:55:56 +00:00
$I->assertEquals(
DB::table('cart_rule_channels')
->pluck('cart_rule_id', 'channel_id')
->toArray(),
[1 => $original->id + 1]
);
$I->assertEquals(
DB::table('cart_rule_customer_groups')
->pluck('cart_rule_id', 'customer_group_id')
->toArray(),
[1 => $original->id + 1]
);
$I->seeResponseCodeIsSuccessful();
bagisto master backmerge (#26) * introduce cronjob to automatically deactivate expired events * remove irrelevant code * extend cart rule validation with search in cart item additional * add additional to all languages * add ValidatorCest * add ValidatorCest * Fixed case sensitivity typo in Bundle class * Update 503.blade.php * Added customer group price * Fixed bundle type class compatablity issue * Refactor some changes Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> * add english translation to foreign languages * fix compatibility issue to AbstractType * check if product_id exists * make a prefix to the copied cart rule ('copy of XXX') and properly save related channels and customer groups after replication * add table, lists, link and hr functionality to editor * Issue #3164 fixed * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Turkish Language added and English language duplicate rows deleted. * Issue #3113 fixed * fix tiny issues due to code guidelines * add default value for search term * fix typo * Fixed typo in customer group price migration * Issue #3171 fixed * Issue #3070 fixed * minified jquery-ez-plus file * Issue #3160 fixed Co-authored-by: Shubham Mehrotra <shubh0896m@gmail.com> Co-authored-by: Matt April <matthew.japril@gmail.com> Co-authored-by: bhumikaisarani <63963172+bhumikaisarani@users.noreply.github.com> Co-authored-by: Jitendra Singh <39991107+jitendra-webkul@users.noreply.github.com> Co-authored-by: Pranshu Tomar <pranshutomar@Pranshus-MacBook-Air.local> Co-authored-by: Florian Bosdorff <26360670+bosix@users.noreply.github.com> Co-authored-by: Herbert Maschke <thyseus@pm.me> Co-authored-by: phillipmohr <phillip.mohr@sellerboost.de> Co-authored-by: İlyas Okay <ilyasokay@hotmail.com> Co-authored-by: Florian Bosdorff <florian.bosdorff@haendlerbund.de> Co-authored-by: phillipcodes <57101430+phillipcodes@users.noreply.github.com>
2020-06-09 05:55:56 +00:00
$I->seeCurrentRouteIs('admin.cart-rules.copy');
}
}