Запуск behat выводит надоедливую стандартную ошибку PHP / уведомление

Я попытался реализовать ответы на эти два вопроса:

Но не повезло: всякий раз, когда я запускаю его, я получаю это сообщение до запуска функций:

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

В моем файле FeatureContext.php выше определения класса я имею:

ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_STRICT);
define('BEHAT_ERROR_REPORTING', E_ERROR);

Но я все еще получаю ошибки. Как я могу их скрыть?

0

Решение

я не профессионал в симфонии и бехате, но

 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

эта ошибка говорит о том, что вы не соответствовали объявлению функций

я вижу 1 способ решить проблему, добавить $ short = false в объявлении Behat \ Behat \ Console \ Input \ InputDefinition :: getSynopsis ($ short = false)

это ничего не изменит, но отражение в Behat перестанет беспокоить вас

2

Другие решения

Оказывается, я следовал нескольким устаревшим учебникам, в которых использовалась старая, не поддерживаемая версия Behat (2.4. *). Я узнал об этом, подняв вопрос о репозитории Behat’s Github:

https://github.com/Behat/Behat/issues/773#issuecomment-126410052

Композитор.json, который, наконец, работал для меня, был:

{
"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/"}
}

И мой behat.yml был:

default:
suites:
default:
contexts:
- FeatureContext:
parameters:
my_empty_array:
'mydummykey1': 'mydummyvalue1'
extensions:
Behat\MinkExtension:
base_url: http://localhost
goutte: ~
selenium2: ~
0

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector