Created
March 16, 2018 09:10
-
-
Save franzose/9a80b7966505b090810f46f0e66a2bf5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
default: | |
extensions: | |
YourVendor\YourPackage\Behat\Extension\ClassLoaderExtension: ~ | |
# | |
# some other extensions and setup | |
# |
This file contains hidden or 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
<?php | |
// YourVendor/YourPackage/Behat/Legacy/ClassLoader.php | |
declare(strict_types=1); | |
namespace YourVendor\YourPackage\Behat\Legacy; | |
use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; | |
try { | |
require_once 'path/to/vendor/symfony/class-loader/ClassLoader.php'; | |
} catch (\Throwable $exception) { | |
// | |
} | |
class ClassLoader extends SymfonyClassLoader | |
{ | |
} |
This file contains hidden or 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
<?php | |
declare(strict_types=1); | |
namespace YourVendor\YourPackage\Behat\Extension; | |
use Behat\Testwork\ServiceContainer\Extension; | |
use Behat\Testwork\ServiceContainer\ExtensionManager; | |
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Definition; | |
use YourVendor\YourPackage\Behat\Legacy\ClassLoader; | |
final class ClassLoaderExtension implements Extension | |
{ | |
public function process(ContainerBuilder $container) | |
{ | |
} | |
public function getConfigKey() | |
{ | |
return 'behat_workaround'; | |
} | |
public function initialize(ExtensionManager $extensionManager) | |
{ | |
} | |
public function configure(ArrayNodeDefinition $builder) | |
{ | |
} | |
public function load(ContainerBuilder $container, array $config) | |
{ | |
// Reset 'class_loader' definition to the class we created earlier. | |
$container->setDefinition('class_loader', new Definition(ClassLoader::class)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment