Skip to content

Commit

Permalink
Use FriendsOfBehat\SymfonyExtension v2
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Jan 16, 2019
1 parent 163545e commit 708c5cd
Show file tree
Hide file tree
Showing 105 changed files with 458 additions and 531 deletions.
48 changes: 47 additions & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,51 @@
# This file is referenced in Sylius-Standard v1.0.0 - v1.3.x

imports:
- src/Sylius/Behat/Resources/config/profiles.yml
- src/Sylius/Behat/Resources/config/suites.yml

default:
formatters:
pretty:
verbose: true
paths: false
snippets: false

extensions:
Lakion\Behat\MinkDebugExtension:
directory: etc/build
clean_start: false
screenshot: true

Behat\MinkExtension:
files_path: "%paths.base%/src/Sylius/Behat/Resources/fixtures/"
base_url: "http://localhost:8080/"
default_session: symfony
javascript_session: chrome
sessions:
symfony:
symfony: ~
chrome:
selenium2:
browser: chrome
capabilities:
browserName: chrome
browser: chrome
version: ""
marionette: null # https://github.com/Behat/MinkExtension/pull/311
chrome:
switches:
- "start-fullscreen"
- "start-maximized"
- "no-sandbox"
firefox:
selenium2:
browser: firefox
show_auto: false

FriendsOfBehat\SymfonyExtension: ~

FriendsOfBehat\VariadicExtension: ~

gherkin:
filters:
tags: "~@todo && ~@cli" # CLI is excluded as it registers an error handler that mutes fatal errors
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@
"behat/mink-browserkit-driver": "^1.3",
"behat/mink-extension": "^2.2",
"behat/mink-selenium2-driver": "^1.3",
"friends-of-behat/context-service-extension": "^1.2",
"friends-of-behat/cross-container-extension": "^1.1",
"friends-of-behat/page-object-extension": "^0.2",
"friends-of-behat/service-container-extension": "^1.0",
"friends-of-behat/symfony-extension": "^1.2.1",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/symfony-extension": "^2.0.0-rc.2",
"friends-of-behat/variadic-extension": "^1.1",
"hwi/oauth-bundle": "^0.6",
"lchrusciel/api-test-case": "^3.1.0",
Expand Down Expand Up @@ -180,10 +177,10 @@
},
"conflict": {
"symfony/browser-kit": "4.1.8",
"symfony/dependency-injection": "4.1.8",
"symfony/dependency-injection": "4.1.8 || 4.2.2",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8",
"symfony/symfony": "3.4.7 || 4.0.7 || 4.1.8",
"symfony/symfony": "3.4.7 || 4.0.7 || 4.1.8 || 4.2.2",
"twig/twig": "2.6.1"
},
"suggest": {
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
];
2 changes: 2 additions & 0 deletions config/services_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "../src/Sylius/Behat/Resources/config/services.xml" }
2 changes: 2 additions & 0 deletions config/services_test_cached.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "services_test.yaml" }
4 changes: 2 additions & 2 deletions etc/travis/suites/application/script/test-behat-with-cli
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ run_behat() {
local code=0

print_header "Testing (Behat - CLI commands, regular scenarios; @cli && ~@todo)" "Sylius"
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\"" || code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"@cli && ~@todo\"" || code=$?
if [[ ${code} = 1 ]]; then
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\" --rerun" ; code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"@cli && ~@todo\" --rerun" ; code=$?
fi

return ${code}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ run_behat() {
local code=0

print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius"
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\"" || code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"@javascript && ~@todo && ~@cli\"" || code=$?
if [[ ${code} = 1 ]]; then
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
fi

return ${code}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ run_behat() {
local code=0

print_header "Testing (Behat - brand new, regular scenarios; ~@javascript && ~@todo && ~@cli)" "Sylius"
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\"" || code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"~@javascript && ~@todo && ~@cli\"" || code=$?
if [[ ${code} = 1 ]]; then
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress --tags=\"~@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
fi

return ${code}
Expand Down
10 changes: 9 additions & 1 deletion src/Sylius/Behat/Context/Setup/ProductContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,16 @@ public function __construct(
ProductVariantResolverInterface $defaultVariantResolver,
ImageUploaderInterface $imageUploader,
SlugGeneratorInterface $slugGenerator,
array $minkParameters
$minkParameters
) {
if (!is_array($minkParameters) && !$minkParameters instanceof \ArrayAccess) {
throw new \InvalidArgumentException(sprintf(
'"$minkParameters" passed to "%s" has to be an array or implement "%s".',
self::class,
\ArrayAccess::class
));
}

$this->sharedStorage = $sharedStorage;
$this->productRepository = $productRepository;
$this->productFactory = $productFactory;
Expand Down
10 changes: 9 additions & 1 deletion src/Sylius/Behat/Context/Setup/TaxonomyContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ public function __construct(
ObjectManager $objectManager,
ImageUploaderInterface $imageUploader,
TaxonSlugGeneratorInterface $taxonSlugGenerator,
array $minkParameters
$minkParameters
) {
if (!is_array($minkParameters) && !$minkParameters instanceof \ArrayAccess) {
throw new \InvalidArgumentException(sprintf(
'"$minkParameters" passed to "%s" has to be an array or implement "%s".',
self::class,
\ArrayAccess::class
));
}

$this->taxonRepository = $taxonRepository;
$this->taxonFactory = $taxonFactory;
$this->taxonTranslationFactory = $taxonTranslationFactory;
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Crud/CreatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class CreatePage extends SymfonyPage implements CreatePageInterface
/** @var string */
private $routeName;

public function __construct(Session $session, array $parameters, RouterInterface $router, string $routeName)
public function __construct(Session $session, $minkParameters, RouterInterface $router, string $routeName)
{
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->routeName = $routeName;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Crud/IndexPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class IndexPage extends SymfonyPage implements IndexPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor,
string $routeName
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
$this->routeName = $routeName;
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Crud/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class UpdatePage extends SymfonyPage implements UpdatePageInterface
/** @var string */
private $routeName;

public function __construct(Session $session, array $parameters, RouterInterface $router, string $routeName)
public function __construct(Session $session, $minkParameters, RouterInterface $router, string $routeName)
{
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->routeName = $routeName;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/DashboardPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class DashboardPage extends SymfonyPage implements DashboardPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Order/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class ShowPage extends SymfonyPage implements ShowPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Product/IndexPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ final class IndexPage extends CrudIndexPage implements IndexPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor,
string $routeName,
ImageExistenceCheckerInterface $imageExistenceChecker
) {
parent::__construct($session, $parameters, $router, $tableAccessor, $routeName);
parent::__construct($session, $minkParameters, $router, $tableAccessor, $routeName);

$this->imageExistenceChecker = $imageExistenceChecker;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/External/PaypalExpressCheckoutPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class PaypalExpressCheckoutPage extends Page implements PaypalExpressCheckoutPag
/** @var RepositoryInterface */
private $securityTokenRepository;

public function __construct(Session $session, array $parameters, RepositoryInterface $securityTokenRepository)
public function __construct(Session $session, $minkParameters, RepositoryInterface $securityTokenRepository)
{
parent::__construct($session, $parameters);
parent::__construct($session, $minkParameters);

$this->securityTokenRepository = $securityTokenRepository;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Shop/Account/Order/IndexPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class IndexPage extends SymfonyPage implements IndexPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Shop/Account/Order/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class ShowPage extends SymfonyPage implements ShowPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class AddressPage extends SymfonyPage implements AddressPageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
AddressFactoryInterface $addressFactory
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->addressFactory = $addressFactory;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Shop/Checkout/CompletePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class CompletePage extends SymfonyPage implements CompletePageInterface

public function __construct(
Session $session,
array $parameters,
$minkParameters,
RouterInterface $router,
TableAccessorInterface $tableAccessor
) {
parent::__construct($session, $parameters, $router);
parent::__construct($session, $minkParameters, $router);

$this->tableAccessor = $tableAccessor;
}
Expand Down
6 changes: 0 additions & 6 deletions src/Sylius/Behat/Resources/config/profiles.yml

This file was deleted.

10 changes: 0 additions & 10 deletions src/Sylius/Behat/Resources/config/profiles/cached.yml

This file was deleted.

59 changes: 0 additions & 59 deletions src/Sylius/Behat/Resources/config/profiles/default.yml

This file was deleted.

Loading

0 comments on commit 708c5cd

Please sign in to comment.