This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
19 changed files
with
104 additions
and
116 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
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,3 +1,3 @@ | ||
<?php | ||
require __DIR__ . '/globals.php'; | ||
require __DIR__.'/globals.php'; | ||
require 'PHPUnit/Extensions/SeleniumCommon/prepend.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 |
---|---|---|
@@ -1,32 +1,27 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Reference, | ||
Symfony\Component\DependencyInjection\ContainerBuilder, | ||
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/** | ||
* Selectors handler compilation pass. Registers all avaiable Mink selector engines. | ||
* Selectors handler compilation pass. Registers all available Mink selector engines. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class SelectorsHandlerPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* Processes container. | ||
* | ||
* @param Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('mink.selectors_handler')) { | ||
|
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,32 +1,27 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Reference, | ||
Symfony\Component\DependencyInjection\ContainerBuilder, | ||
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/** | ||
* Behat\Mink container compilation pass. Registers all available in controller Mink sessions. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class SessionsPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* Processes container. | ||
* | ||
* @param Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('behat.mink')) { | ||
|
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,23 +1,23 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder, | ||
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/** | ||
* Behat\Mink container compilation pass. Replaces test session listener for real session listener. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class TestSessionListenerPass implements CompilerPassInterface | ||
{ | ||
|
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,31 +1,26 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder, | ||
Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* MinkBundle configuration manager. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* Returns configuration tree. | ||
* | ||
* @return Symfony\Component\Config\Definition\Builder\TreeBuilder | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
|
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,35 +1,29 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Processor, | ||
Symfony\Component\HttpKernel\DependencyInjection\Extension, | ||
Symfony\Component\DependencyInjection\Loader\XmlFileLoader, | ||
Symfony\Component\DependencyInjection\ContainerBuilder, | ||
Symfony\Component\Config\FileLocator; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Processor; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\FileLocator; | ||
|
||
/** | ||
* Symfony2 Behat\Mink extension. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class MinkExtension extends Extension | ||
{ | ||
/** | ||
* Loads the services based on your application configuration. | ||
* | ||
* @param array $configs | ||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$processor = new Processor(); | ||
|
@@ -91,7 +85,7 @@ public function load(array $configs, ContainerBuilder $container) | |
|
||
if (!$container->hasParameter('mink.paths.lib')) { | ||
$minkReflection = new \ReflectionClass('Behat\Mink\Mink'); | ||
$minkLibPath = realpath(dirname($minkReflection->getFilename()) . '/../../../'); | ||
$minkLibPath = realpath(dirname($minkReflection->getFilename()).'/../../../'); | ||
$container->setParameter('mink.paths.lib', $minkLibPath); | ||
} | ||
} | ||
|
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,35 +1,28 @@ | ||
<?php | ||
|
||
namespace Behat\MinkBundle; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder, | ||
Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
use Behat\MinkBundle\DependencyInjection\Compiler\SessionsPass, | ||
Behat\MinkBundle\DependencyInjection\Compiler\SelectorsHandlerPass, | ||
Behat\MinkBundle\DependencyInjection\Compiler\TestSessionListenerPass; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
use Behat\MinkBundle\DependencyInjection\Compiler\SessionsPass; | ||
use Behat\MinkBundle\DependencyInjection\Compiler\SelectorsHandlerPass; | ||
|
||
/** | ||
* MinkBundle. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class MinkBundle extends Bundle | ||
{ | ||
/** | ||
* Registers compilation passes. | ||
* | ||
* @param Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
parent::build($container); | ||
|
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
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,20 +1,19 @@ | ||
<?php | ||
namespace Behat\MinkBundle\Test; | ||
|
||
use Symfony\Component\Finder\Finder; | ||
use Symfony\Component\HttpKernel\HttpKernelInterface; | ||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
use Behat\Mink\Mink; | ||
|
||
/* | ||
* This file is part of the Behat\MinkBundle | ||
* This file is part of the Behat MinkBundle | ||
* | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Behat\MinkBundle\Test; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
use Behat\Mink\Mink; | ||
|
||
/** | ||
* Mink PHPUnit test case. | ||
* | ||
|
@@ -76,6 +75,7 @@ public function getMink() | |
$this->coverageScriptUrl = $container->getParameter('mink.coverage_script_url'); | ||
self::$mink = $container->get('behat.mink'); | ||
} | ||
|
||
return self::$mink; | ||
} | ||
|
||
|
@@ -90,6 +90,7 @@ public static function getKernel() | |
if (!static::$kernel->getContainer()) { | ||
static::$kernel->boot(); | ||
} | ||
|
||
return static::$kernel; | ||
} | ||
|
||
|
@@ -103,7 +104,7 @@ public function getContainer() | |
|
||
protected function initTestCoverage() | ||
{ | ||
$this->testId = get_class($this) . '__' . $this->getName(); | ||
$this->testId = get_class($this).'__'.$this->getName(); | ||
if ($this->collectCodeCoverageInformation && $this->coverageScriptUrl) { | ||
$this->getMink()->getSession()->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId); | ||
} | ||
|
@@ -115,6 +116,7 @@ protected function initTestCoverage() | |
public function runTest() | ||
{ | ||
$this->initTestCoverage(); | ||
|
||
return parent::runTest(); | ||
} | ||
|
||
|
@@ -133,8 +135,10 @@ protected function findDirectorySeparator($path) | |
} | ||
|
||
/** | ||
* @param array $coverage | ||
* @param array $coverage | ||
* | ||
* @return array | ||
* | ||
* @author Mattis Stordalen Flister <[email protected]> | ||
*/ | ||
protected function matchLocalAndRemotePaths(array $coverage) | ||
|
@@ -160,11 +164,12 @@ protected function matchLocalAndRemotePaths(array $coverage) | |
|
||
/** | ||
* @param \PHPUnit_Framework_TestResult $result | ||
* | ||
* @return \PHPUnit_Framework_TestResult | ||
*/ | ||
public function run(\PHPUnit_Framework_TestResult $result = null) | ||
{ | ||
if ($result === null) { | ||
if (null === $result) { | ||
$result = $this->createResult(); | ||
} | ||
|
||
|
@@ -177,7 +182,6 @@ public function run(\PHPUnit_Framework_TestResult $result = null) | |
$this->collectCodeCoverageInformation && | ||
$this->coverageScriptUrl | ||
) { | ||
|
||
$session = $mink->getSession('goutte'); | ||
|
||
$url = sprintf( | ||
|
@@ -194,7 +198,7 @@ public function run(\PHPUnit_Framework_TestResult $result = null) | |
if (is_array($coverage)) { | ||
$coverage = $this->matchLocalAndRemotePaths($coverage); | ||
} else { | ||
throw new \RuntimeException('Empty or invalid code coverage data received from url "' . $url . '"'); | ||
throw new \RuntimeException('Empty or invalid code coverage data received from url "'.$url.'"'); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.