Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions features/export/ui/export_check_ids.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Export links on Countries grid

@ui
Scenario: Exporting countries should export all of them
When I open the country admin index page
And I import country data from "countries.csv" csv file
Given I am on country import page
And I import data from "countries.csv" csv file
Then I should see a notification that the import was successful
When I open the country admin index page
And I should see 10 countries in the list
Then I go to "/admin/export/sylius.country/csv" homepage
And response should contain "Id,Code,Enabled"
Expand Down
8 changes: 6 additions & 2 deletions features/import/ui/importing_countries_from_csv.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ Feature: Importing countries from csv
@ui
Scenario: Importing countries based on a valid csv-file
When I open the country admin index page
And I import country data from "countries.csv" csv file
Then I should see an import button
When I click an import button
Then I should be on country import page
When I import data from "countries.csv" csv file
Then I should see a notification that the import was successful
And I should see 10 countries in the list
When I open the country admin index page
Then I should see 10 countries in the list
And I open the country admin index second page
And I should see 3 countries in the list
And the country "Andorra" should appear in the registry
Expand Down
8 changes: 6 additions & 2 deletions features/import/ui/importing_countries_from_excel.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ Feature: Importing countries from excel
@ui
Scenario: Importing countries based on a valid excel-file
When I open the country admin index page
And I import country data from "countries.xlsx" xlsx file
Then I should see an import button
When I click an import button
Then I should be on country import page
When I import data from "countries.xlsx" xlsx file
Then I should see a notification that the import was successful
And I should see 10 countries in the list
When I open the country admin index page
Then I should see 10 countries in the list
And I open the country admin index second page
And I should see 3 countries in the list
And the country "Andorra" should appear in the registry
Expand Down
8 changes: 6 additions & 2 deletions features/import/ui/importing_countries_from_json.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ Feature: Importing countries from json
@ui
Scenario: Importing countries based on a valid json-file
When I open the country admin index page
And I import country data from "countries.json" json file
Then I should see an import button
When I click an import button
Then I should be on country import page
When I import data from "countries.json" json file
Then I should see a notification that the import was successful
And I should see 2 countries in the list
When I open the country admin index page
Then I should see 2 countries in the list
And the country "Germany" should appear in the registry
And the country "Switzerland" should appear in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Feature: Importing customer-groups from csv

@ui
Scenario: Importing customer-groups based on a valid csv-file
When I import customer-group data from "customer_groups.csv" csv file
Given I am on customer group import page
When I import data from "customer_groups.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 customer groups in the list
When I want to browse customer groups
Then I should see 2 customer groups in the list
And I should see the customer group "premium" in the list
And I should see the customer group "basic" in the list
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Feature: Importing customer-groups from excel

@ui
Scenario: Importing customer-groups based on a valid excel-file
When I import customer-group data from "customer_groups.xlsx" xlsx file
Given I am on customer group import page
When I import data from "customer_groups.xlsx" xlsx file
Then I should see a notification that the import was successful
And I should see 2 customer groups in the list
When I want to browse customer groups
Then I should see 2 customer groups in the list
And I should see the customer group "premium" in the list
And I should see the customer group "basic" in the list
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Feature: Importing customer-groups from json

@ui
Scenario: Importing customer-groups based on a valid json-file
When I import customer-group data from "customer_groups.json" json file
Given I am on customer group import page
When I import data from "customer_groups.json" json file
Then I should see a notification that the import was successful
And I should see 2 customer groups in the list
When I want to browse customer groups
Then I should see 2 customer groups in the list
And I should see the customer group "premium" in the list
And I should see the customer group "basic" in the list
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing payment methods from csv with the user interface

@ui
Scenario: Importing payment methods based on a valid csv-file
When I browse payment methods
And I import payment methods data from "payment-methods.csv" csv file
Given I am on payment method import page
When I import data from "payment-methods.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 payment methods in the list
When I browse payment methods
Then I should see 2 payment methods in the list
And the payment method "Offline" should be in the registry
And the payment method "PayPal" should be in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing payment methods from excel with the user interface

@ui
Scenario: Importing payment methods based on a valid excel file
When I browse payment methods
And I import payment methods data from "payment-methods.xlsx" xlsx file
Given I am on payment method import page
When I import data from "payment-methods.xlsx" xlsx file
Then I should see a notification that the import was successful
And I should see 2 payment methods in the list
When I browse payment methods
Then I should see 2 payment methods in the list
And the payment method "Offline" should be in the registry
And the payment method "PayPal" should be in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing payment methods from json with the user interface

@ui
Scenario: Importing payment methods based on a valid json-file
When I browse payment methods
And I import payment methods data from "payment-methods.json" json file
Given I am on payment method import page
When I import data from "payment-methods.json" json file
Then I should see a notification that the import was successful
And I should see 2 payment methods in the list
When I browse payment methods
Then I should see 2 payment methods in the list
And the payment method "Offline" should be in the registry
And the payment method "PayPal" should be in the registry
7 changes: 4 additions & 3 deletions features/import/ui/importing_products.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Import Products from grid

@ui
Scenario: Import products should create all of them
When I open the product admin index page
And I import product data from "products.csv" csv file
Given I am on product import page
And I import data from "products.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 products in the list
When I browse products
Then I should see 2 products in the list
And the first product on the list should have name "Product 1"
And the last product on the list should have name "Product 2"
9 changes: 5 additions & 4 deletions features/import/ui/importing_products_update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ Feature: Import Products from grid

@ui
Scenario: Import products should update them
When I open the product admin index page
And I import product data from "products.csv" csv file
Given I am on product import page
And I import data from "products.csv" csv file
Then I should see a notification that the import was successful
And I import product data from "products_update.csv" csv file
And I import data from "products_update.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 products in the list
When I browse products
Then I should see 2 products in the list
And the first product on the list should have name "Product 1"
And the last product on the list should have name "Product 2 update"
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Feature: Import Products with attributes from grid

@ui
Scenario: Exporting products should export all of them
When I open the product admin index page
And I import product data from "products_attr.csv" csv file
Given I am on product import page
And I import data from "products_attr.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 products in the list
When I browse products
Then I should see 2 products in the list
Then the product "Product 1" should appear in the registry
And attribute "Attribute text" of product "Product 1" should be "Banana" in "en_US"
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing tax categories from csv with the user interface

@ui
Scenario: Importing defined tax categories
When I browse all tax categories
And I import tax category data from "tax_categories.csv" csv file
Given I am on tax category import page
Then I import data from "tax_categories.csv" csv file
Then I should see a notification that the import was successful
And I should see 2 tax categories in the list
When I browse all tax categories
Then I should see 2 tax categories in the list
And the tax category "books" should appear in the registry
And the tax category "cars" should appear in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing tax categories from excel with the user interface

@ui
Scenario: Importing defined tax categories
When I browse all tax categories
And I import tax category data from "tax_categories.xlsx" xlsx file
Given I am on tax category import page
When I import data from "tax_categories.xlsx" xlsx file
Then I should see a notification that the import was successful
And I should see 2 tax categories in the list
When I browse all tax categories
Then I should see 2 tax categories in the list
And the tax category "books" should appear in the registry
And the tax category "cars" should appear in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Feature: Importing tax categories from json with the user interface

@ui
Scenario: Importing defined tax categories
When I browse all tax categories
And I import tax category data from "tax_categories.json" json file
Given I am on tax category import page
And I import data from "tax_categories.json" json file
Then I should see a notification that the import was successful
And I should see 2 tax categories in the list
When I browse all tax categories
Then I should see 2 tax categories in the list
And the tax category "books" should appear in the registry
And the tax category "cars" should appear in the registry
6 changes: 6 additions & 0 deletions spec/Controller/ImportDataControllerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@

use FriendsOfSylius\SyliusImportExportPlugin\Controller\ImportDataController;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactoryInterface;
use Sylius\Component\Registry\ServiceRegistryInterface;
use Sylius\Component\Resource\Metadata\RegistryInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;

class ImportDataControllerSpec extends ObjectBehavior
{
function let(
RequestConfigurationFactoryInterface $configurationFactory,
RegistryInterface $resourceRegistry,
ServiceRegistryInterface $registry,
FlashBagInterface $flashBag,
FormFactoryInterface $formFactory,
\Twig_Environment $twig
) {
$this->beConstructedWith(
$configurationFactory,
$resourceRegistry,
$registry,
$flashBag,
$formFactory,
Expand Down
28 changes: 14 additions & 14 deletions spec/DependencyInjection/Compiler/RegisterImporterPassSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace spec\FriendsOfSylius\SyliusImportExportPlugin\DependencyInjection\Compiler;

use FriendsOfSylius\SyliusImportExportPlugin\DependencyInjection\Compiler\RegisterImporterPass;
use FriendsOfSylius\SyliusImportExportPlugin\Listener\ImportButtonGridListener;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\UiBundle\Block\BlockEventListener;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -27,7 +27,7 @@ function it_is_initializable()
function it_processes_the_importer_services(
ContainerBuilder $container,
Definition $importerRegistry,
Definition $blockEventDefinition
Definition $importButtonListenerDefinition
) {
$importerType = 'csv';
/**
Expand All @@ -47,8 +47,8 @@ function it_processes_the_importer_services(
]);
$container->register(
Argument::type('string'),
BlockEventListener::class
)->willReturn($blockEventDefinition)->shouldBeCalled();
ImportButtonGridListener::class
)->willReturn($importButtonListenerDefinition)->shouldBeCalled();

/**
* prepare the mock for the importerRegistry
Expand All @@ -61,23 +61,23 @@ function it_processes_the_importer_services(
/**
* prepare the mock for the definition of the sonata-event
*/
$blockEventDefinition->setAutowired(false)
$importButtonListenerDefinition->setAutowired(false)
->shouldBeCalled()
->willReturn($blockEventDefinition);
->willReturn($importButtonListenerDefinition);

$blockEventDefinition->addArgument(Argument::type('string'))
$importButtonListenerDefinition->addArgument(Argument::type('string'))
->shouldBeCalled()
->willReturn($blockEventDefinition);
->willReturn($importButtonListenerDefinition);

$blockEventDefinition->addTag(
'kernel.event_listener',
$importButtonListenerDefinition->addTag(
'kernel.event_listener',
[
'event' => 'sonata.block.event.sylius.admin.' . $importerType . '.index.after_content',
'method' => 'onBlockEvent',
'event' => 'sylius.grid.admin_' . $importerType,
'method' => 'onSyliusGridAdmin',
]
)
)
->shouldBeCalled()
->willReturn($blockEventDefinition);
->willReturn($importButtonListenerDefinition);

/**
* run the test
Expand Down
Loading