Try to run tests with Behat @ dev-master
This commit is contained in:
@@ -15,10 +15,6 @@ jobs:
|
||||
-
|
||||
php: '7.1'
|
||||
env: SYMFONY_VERSION=5.0.*
|
||||
allow_failures:
|
||||
-
|
||||
env: SYMFONY_VERSION=5.0.*
|
||||
fast_finish: true
|
||||
|
||||
cache:
|
||||
directories:
|
||||
@@ -31,10 +27,14 @@ install:
|
||||
- composer require symfony/dependency-injection:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
- composer require symfony/http-kernel:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
- composer require symfony/proxy-manager-bridge:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
|
||||
- composer require --dev symfony/browser-kit:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
- composer require --dev symfony/framework-bundle:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
- composer require --dev symfony/process:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
- composer require --dev symfony/yaml:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
|
||||
|
||||
- if [ "$SYMFONY_VERSION" = "5.0.*" ]; then composer require --dev behat/behat:dev-master --no-update --no-scripts --prefer-dist; fi
|
||||
|
||||
- composer update --prefer-dist
|
||||
|
||||
script:
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
"symfony/proxy-manager-bridge": "^3.4|^4.4|^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"behat/mink": "^1.7",
|
||||
"behat/mink-browserkit-driver": "^1.3",
|
||||
"behat/mink-extension": "^2.2",
|
||||
"friends-of-behat/mink": "^1.7",
|
||||
"friends-of-behat/mink-browserkit-driver": "^1.3",
|
||||
"friends-of-behat/mink-extension": "^2.2",
|
||||
"behat/mink-selenium2-driver": "^1.3",
|
||||
"friends-of-behat/page-object-extension": "^0.3.1",
|
||||
"friends-of-behat/service-container-extension": "^1.0",
|
||||
|
||||
@@ -31,12 +31,14 @@ Feature: BrowserKit integration
|
||||
use Behat\Behat\Context\Context;
|
||||
use FriendsOfBehat\SymfonyExtension\Mink\MinkParameters;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\Client;
|
||||
|
||||
final class SomeContext implements Context {
|
||||
/** @var Client|AbstractBrowser */
|
||||
private $client;
|
||||
|
||||
public function __construct(Client $client)
|
||||
public function __construct($client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
@@ -75,6 +77,9 @@ Feature: BrowserKit integration
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
bind:
|
||||
$client: "@test.client"
|
||||
|
||||
App\Tests\SomeContext: ~
|
||||
"""
|
||||
When I run Behat
|
||||
|
||||
@@ -7,3 +7,6 @@ parameters:
|
||||
- '/Cannot call method [a-zA-Z0-9]+\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface|null\./'
|
||||
- '/Method FriendsOfBehat\\SymfonyExtension\\Context\\Environment\\InitializedSymfonyExtensionEnvironment::bindCallee\(\) should return callable/'
|
||||
- '/Strict comparison using === between 0\|1 and 2 will always evaluate to false\./'
|
||||
- '/Class Symfony\\Component\\BrowserKit\\Client not found\./'
|
||||
- '/Class Symfony\\Component\\BrowserKit\\AbstractBrowser not found\./'
|
||||
- '/Parameter \#1 \$client of method Behat\\Mink\\Driver\\BrowserKitDriver::__construct\(\) expects/'
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace FriendsOfBehat\SymfonyExtension\Driver;
|
||||
|
||||
use Behat\Mink\Driver\BrowserKitDriver;
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\Client;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
@@ -25,10 +26,11 @@ final class SymfonyDriver extends BrowserKitDriver
|
||||
/** @var object $testClient */
|
||||
$testClient = $kernel->getContainer()->get('test.client');
|
||||
|
||||
if (!$testClient instanceof Client) {
|
||||
if (!$testClient instanceof Client && !$testClient instanceof AbstractBrowser) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
'Service "test.client" should be an instance of "%s", "%s" given.',
|
||||
'Service "test.client" should be an instance of "%s" or "%s", "%s" given.',
|
||||
Client::class,
|
||||
AbstractBrowser::class,
|
||||
get_class($testClient)
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user