-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
robertfausk
committed
Apr 28, 2019
1 parent
f7786e9
commit 8158cab
Showing
6 changed files
with
219 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
composer.phar | ||
composer.lock | ||
/vendor/ | ||
|
||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
# composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
language: php | ||
|
||
addons: | ||
chrome: stable | ||
|
||
sudo: false | ||
|
||
php: [7.1, 7.2, 7.3] | ||
|
||
matrix: | ||
allow_failures: | ||
- env: DEPENDENCIES='dev' | ||
- php: 7.3 | ||
fast_finish: true | ||
include: | ||
# Test against dev versions of dependencies | ||
- php: 7.3 | ||
env: DEPENDENCIES='dev' | ||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
|
||
before_install: | ||
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi; | ||
|
||
install: | ||
- composer install --no-progress | ||
|
||
script: | ||
- vendor/bin/phpspec run -f pretty | ||
- vendor/bin/behat -fprogress --strict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# behat-panther-extension | ||
# BehatPantherExtension | ||
|
||
[![Latest Stable Version](https://poser.pugx.org/robertfausk/behat-panther-extension/v/stable.svg)](https://packagist.org/packages/robertfausk/behat-panther-extension) | ||
[![Latest Unstable Version](https://poser.pugx.org/robertfausk/behat-panther-extension/v/unstable.svg)](https://packagist.org/packages/robertfausk/behat-panther-extension) | ||
[![Total Downloads](https://poser.pugx.org/robertfausk/behat-panther-extension/downloads.svg)](https://packagist.org/packages/robertfausk/behat-panther-extension) | ||
[![License](https://poser.pugx.org/robertfausk/behat-panther-extension/license.svg)](https://packagist.org/packages/robertfausk/behat-panther-extension) | ||
|
||
|
||
Symfony Panther extension for Behat | ||
|
||
## Install | ||
|
||
```BASH | ||
composer require --dev robertfausk/behat-panther-extension | ||
``` | ||
|
||
## Credits | ||
|
||
Created by Robert Freigang [robertfausk](https://github.com/robertfausk). | ||
|
||
MinkPantherDriver is built on top of [Panther](https://github.com/symfony/panther) and for usage with [Behat and Mink](http://behat.org/en/latest/cookbooks/integrating_symfony2_with_behat.html#initialising-behat). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "robertfausk/behat-panther-extension", | ||
"type": "behat-extension", | ||
"description": "Symfony Panther extension for Behat", | ||
"keywords": [ | ||
"behat", | ||
"symfony", | ||
"panther", | ||
"web", | ||
"test", | ||
"browser", | ||
"gui" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Robert Freigang", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.1", | ||
"behat/behat": "^3.0.5", | ||
"behat/mink-extension": "^2.0", | ||
"symfony/config": "^3.4|^4.0" | ||
}, | ||
"require-dev": { | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Robertfausk\\BehatPantherExtension": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0.x-dev" | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/Robertfausk/Behat/PantherExtension/ServiceContainer/Driver/PantherFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Robertfausk\Behat\PantherExtension\ServiceContainer\Driver; | ||
|
||
use Behat\MinkExtension\ServiceContainer\Driver\DriverFactory; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
|
||
/** | ||
* @author Robert Freigang <robertfreigang@gmx.de> | ||
*/ | ||
class PantherFactory implements DriverFactory | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDriverName() | ||
{ | ||
return 'panther'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function supportsJavascript() | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function configure(ArrayNodeDefinition $builder) | ||
{ | ||
$builder | ||
->children() | ||
->arrayNode('options') | ||
->useAttributeAsKey('key') | ||
->prototype('variable')->end() | ||
->info( | ||
"These are the options passed as first argument to PantherTestcaseTrait::createPantherClient client constructor." | ||
) | ||
->end() | ||
->end() | ||
; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildDriver(array $config) | ||
{ | ||
if (!class_exists('Behat\Mink\Driver\PantherDriver')) { | ||
throw new \RuntimeException( | ||
'Install MinkPantherDriver in order to use panther driver.' | ||
); | ||
} | ||
|
||
return new Definition( | ||
'Behat\Mink\Driver\PantherDriver', | ||
array( | ||
$config['options'] | ||
) | ||
); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/Robertfausk/Behat/PantherExtension/ServiceContainer/PantherExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Robertfausk\Behat\PantherExtension\ServiceContainer; | ||
|
||
use Behat\Mink\Driver\Extension\Driver\PantherFactory; | ||
use Behat\MinkExtension\ServiceContainer\MinkExtension; | ||
use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface; | ||
use Behat\Testwork\ServiceContainer\ExtensionManager; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* @author Robert Freigang <robertfreigang@gmx.de> | ||
*/ | ||
final class PantherExtension implements ExtensionInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function process(ContainerBuilder $container): void | ||
{ | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getConfigKey(): string | ||
{ | ||
return 'panther'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function initialize(ExtensionManager $extensionManager): void | ||
{ | ||
/** @var MinkExtension|null $minkExtension */ | ||
$minkExtension = $extensionManager->getExtension('mink'); | ||
|
||
if ($minkExtension === null) { | ||
return; | ||
} | ||
|
||
$minkExtension->registerDriverFactory(new PantherFactory()); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function configure(ArrayNodeDefinition $builder): void | ||
{ | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function load(ContainerBuilder $container, array $config): void | ||
{ | ||
} | ||
} |