I have tried implementing answers from these two questions:
But no luck: whenever I run behat, I still get this message before the features are run:
PHP Strict standards: Declaration of Behat\Behat\Console\Input\InputDefinition::getSynopsis() should be compatible with Symfony\Component\Console\Input\InputDefinition::getSynopsis($short = false) in C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\Input\InputDefinition.php on line 157
PHP Stack trace:
PHP 1. {main}() C:\phpbin\behat\vendor\behat\behat\bin\behat:0
PHP 2. Symfony\Component\Console\Application->run() C:\phpbin\behat\vendor\behat\behat\bin\behat:32
PHP 3. Behat\Behat\Console\BehatApplication->doRun() C:\phpbin\behat\vendor\symfony\console\Application.php:126
PHP 4. Behat\Behat\Console\BehatApplication->createCommand() C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\BehatApplication.php:66
PHP 5. Symfony\Component\DependencyInjection\ContainerBuilder->get() C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\BehatApplication.php:80
PHP 6. Symfony\Component\DependencyInjection\ContainerBuilder->createService() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:504
PHP 7. ReflectionClass->newInstanceArgs() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:980
PHP 8. Behat\Behat\Console\Command\BehatCommand->__construct() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:980
PHP 9. Composer\Autoload\ClassLoader->loadClass() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:0
PHP 10. Composer\Autoload\includeFile() C:\phpbin\behat\vendor\composer\ClassLoader.php:301
Strict standards: Declaration of Behat\Behat\Console\Input\InputDefinition::getSynopsis() should be compatible with Symfony\Component\Console\Input\InputDefinition::getSynopsis($short = false) in C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\Input\InputDefinition.php on line 157
Call Stack:
0.0003 237800 1. {main}() C:\phpbin\behat\vendor\behat\behat\bin\behat:0
0.0250 1812816 2. Symfony\Component\Console\Application->run() C:\phpbin\behat\vendor\behat\behat\bin\behat:32
0.0331 2201280 3. Behat\Behat\Console\BehatApplication->doRun() C:\phpbin\behat\vendor\symfony\console\Application.php:126
0.0331 2201344 4. Behat\Behat\Console\BehatApplication->createCommand() C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\BehatApplication.php:66
0.2716 6867024 5. Symfony\Component\DependencyInjection\ContainerBuilder->get() C:\phpbin\behat\vendor\behat\behat\src\Behat\Behat\Console\BehatApplication.php:80
0.2717 6868160 6. Symfony\Component\DependencyInjection\ContainerBuilder->createService() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:504
0.2903 7223504 7. ReflectionClass->newInstanceArgs() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:980
0.2903 7225288 8. Behat\Behat\Console\Command\BehatCommand->__construct() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:980
0.2904 7226416 9. Composer\Autoload\ClassLoader->loadClass() C:\phpbin\behat\vendor\symfony\dependency-injection\ContainerBuilder.php:0
0.2909 7226568 10. Composer\Autoload\includeFile() C:\phpbin\behat\vendor\composer\ClassLoader.php:301
Feature: Search
In order to use the admin pages
As me (admin)
I need to be able to load the pages
Scenario: Navigating to the admin home page - check title and main heading # features\wikipedia.feature:6
Given I am on "/dabblelabs/admin" # FeatureContext::visit()
Then I should see "Admin" in the "body" element # FeatureContext::assertElementContainsText()
Then the element "body" should contain "Admin Home" # FeatureContext::assertElementContainsString()
Then the title contains "Admin Home" # FeatureContext::assertTitleContains()
1 scenario (1 passed)
4 steps (4 passed)
0m0.245s
In my FeatureContext.php file, above the class definition, I have:
ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_STRICT);
define('BEHAT_ERROR_REPORTING', E_ERROR);
But I still get the errors. How can I hide them?
It turns out that I had followed several out of date tutorials which used an old, unmaintained version of Behat (2.4.*). I learnt that by raising an issue on Behat's Github repo:
https://github.com/Behat/Behat/issues/773#issuecomment-126410052
The composer.json that finally worked for me was:
{
"require": {
"behat/behat": "@stable",
"behat/symfony2-extension": "@stable",
"behat/mink": "@stable",
"behat/mink-extension": "@stable",
"behat/mink-browserkit-driver": "@stable",
"behat/mink-goutte-driver": "@stable",
"behat/mink-selenium2-driver": "@stable",
"phpunit/php-code-coverage": "@stable",
"phpunit/phpunit-mock-objects": "@stable",
"phpunit/phpunit": "@stable"
},
"config": {
"bin-dir": "bin/"
}
}
And my behat.yml was:
default:
suites:
default:
contexts:
- FeatureContext:
parameters:
my_empty_array:
'mydummykey1': 'mydummyvalue1'
extensions:
Behat\MinkExtension:
base_url: http://localhost
goutte: ~
selenium2: ~