Behat,MySql连接错误在Laravel5:'PDOException''SQLSTATE [HY000] [2005]未知MySQL服务器主机'mysql'(2)' [英] Behat, MySql Connection error in Laravel5 : 'PDOException''SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)'

查看:894
本文介绍了Behat,MySql连接错误在Laravel5:'PDOException''SQLSTATE [HY000] [2005]未知MySQL服务器主机'mysql'(2)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在码头集装箱运行Laravel应用程序 dockervel
我的功能是:

Feature: Registation form
    In order to test register on this site
    As a visitor
    I need to fill in the necessary info
Scenario: 
    Given I am on the homepage
    Then I should see "Welcome"

当我运行vendor / bin / behat我得到这个 / p>

When I run vendor/bin/behat I get this

 The text "Welcome" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException)

--- Failed scenarios:

这是在我的日志文件中:

[2016-06-29 19:24:09] local.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' in ../framework/src/Illuminate/Database/Connectors/Connector.php:55
Stack trace:
#1 ../framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=mysq...', Array, Array)
#2 ../framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(61): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#4 ../framework/src/Illuminate/Database/Connection.php(908): call_user_func(Object(Closure))
#5 ../framework/src/Illuminate/Database/Connection.php(776): Illuminate\Database\Connection->getPdo()
#6 ../framework/src/Illuminate/Database/Connection.php(661): Illuminate\Database\Connection->reconnectIfMissingConnection()
#7 ../framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#8 ../framework/src/Illuminate/Database/Query/Builder.php(1583): Illuminate\Database\Connection->select('select * from `...', Array, true)
#9 ../framework/src/Illuminate/Database/Query/Builder.php(1569): Illuminate\Database\Query\Builder->runSelect()
#10 ../framework/src/Illuminate/Database/Eloquent/Builder.php(624): Illuminate\Database\Query\Builder->get(Array)
#11 ../framework/src/Illuminate/Database/Eloquent/Builder.php(316): Illuminate\Database\Eloquent\Builder->getModels(Array)
#12 ../framework/src/Illuminate/Database/Eloquent/Model.php(649): Illuminate\Database\Eloquent\Builder->get(Array)
#13 /home/zagorka/Desktop/final/dockervel/www/app/Http/Controllers/PageController.php(14): Illuminate\Database\Eloquent\Model::all()
#14 [internal function]: App\Http\Controllers\PageController->home()
#15 ../framework/src/Illuminate/Routing/Controller.php(80): call_user_func_array(Array, Array)
#16 ../framework/src/Illuminate/Routing/ControllerDispatcher.php(146): Illuminate\Routing\Controller->callAction('home', Array)
#17 ../framework/src/Illuminate/Routing/ControllerDispatcher.php(94): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\PageController), Object(Illuminate\Routing\Route), 'home')
#18 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#19 ../framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#20 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 ../framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 ../framework/src/Illuminate/Routing/ControllerDispatcher.php(96): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 ../framework/src/Illuminate/Routing/ControllerDispatcher.php(54): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\PageController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'home')
#24 ../framework/src/Illuminate/Routing/Route.php(174): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\\Http\\Contro...', 'home')
#25 ../framework/src/Illuminate/Routing/Route.php(140): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
#26 ../framework/src/Illuminate/Routing/Router.php(724): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#27 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 ../framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#29 ../framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#32 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 ../framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#35 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#37 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#39 ../framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#42 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#44 ../framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#45 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#47 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#49 ../framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#50 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#52 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#53 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#54 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#55 ../framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#56 ../framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#57 ../framework/src/Illuminate/Routing/Router.php(699): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#58 ../framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#59 ../framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#60 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#61 ../framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#62 ../framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#63 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#64 ../framework/src/Illuminate/Pipeline/Pipeline.php(136): call_user_func_array(Array, Array)
#65 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#66 ../framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#67 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#68 ../framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#69 ../framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#70 ../framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#71 ../framework/src/Illuminate/Foundation/Application.php(805): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#72 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/http-kernel/Client.php(79): Illuminate\Foundation\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
#73 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/browser-kit/Client.php(315): Symfony\Component\HttpKernel\Client->doRequest(Object(Symfony\Component\HttpFoundation\Request))
#74 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php(144): Symfony\Component\BrowserKit\Client->request('GET', 'http://localhos...', Array, Array, Array)
#75 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/mink/src/Session.php(143): Behat\Mink\Driver\BrowserKitDriver->visit('http://localhos...')
#76 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php(131): Behat\Mink\Session->visit('http://localhos...')
#77 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/mink-extension/src/Behat/MinkExtension/Context/MinkContext.php(35): Behat\MinkExtension\Context\RawMinkContext->visitPath('/')
#78 [internal function]: Behat\MinkExtension\Context\MinkContext->iAmOnHomepage()
#79 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(104): call_user_func_array(Array, Array)
#80 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(60): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#81 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php(129): Behat\Testwork\Call\Handler\RuntimeCallHandler->handleCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#82 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php(82): Behat\Testwork\Call\CallCenter->handleCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#83 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php(125): Behat\Testwork\Call\CallCenter->makeCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
#84 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php(73): Behat\Behat\Tester\Runtime\RuntimeStepTester->testDefinition(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), Object(Behat\Behat\Definition\SearchResult), false)
#85 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableStepTester.php(74): Behat\Behat\Tester\Runtime\RuntimeStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#86 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php(73): Behat\Behat\Hook\Tester\HookableStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#87 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Tester/StepContainerTester.php(59): Behat\Behat\EventDispatcher\Tester\EventDispatchingStepTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\StepNode), false)
#88 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php(76): Behat\Behat\Tester\StepContainerTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#89 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php(74): Behat\Behat\Tester\Runtime\RuntimeScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#90 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php(103): Behat\Behat\Hook\Tester\HookableScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#91 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php(83): Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->test(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false)
#92 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php(72): Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#93 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php(71): Behat\Behat\Hook\Tester\HookableFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#94 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php(63): Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
#95 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php(73): Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#96 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php(72): Behat\Testwork\Hook\Tester\HookableSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#97 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php(71): Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
#98 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php(70): Behat\Testwork\Tester\Runtime\RuntimeExercise->test(Array, false)
#99 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php(80): Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test(Array, false)
#100 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php(146): Behat\Testwork\Ordering\OrderedExercise->test(Array, false)
#101 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php(108): Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications(Object(Symfony\Component\Console\Input\ArgvInput), Array)
#102 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php(63): Behat\Testwork\Tester\Cli\ExerciseController->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#103 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/console/Command/Command.php(256): Behat\Testwork\Cli\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#104 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/console/Application.php(791): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#105 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Behat\Testwork\Cli\Command), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#106 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php(121): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#107 /home/zagorka/Desktop/final/dockervel/www/vendor/symfony/console/Application.php(117): Behat\Testwork\Cli\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#108 /home/zagorka/Desktop/final/dockervel/www/vendor/behat/behat/bin/behat(32): Symfony\Component\Console\Application->run()
#109 {main}  

我的.env文件看起来像:
.env.behat和.env 拥有相同的内容,它是:

My .env files look like: .env.behat and .env haave the same content and it is:

  APP_ENV=local
    APP_DEBUG=true
    APP_KEY=base64:8TvzjWQxKeDbyPuXFXCY2E0VuFC8vv/+wnGhcU1G4TM=
    APP_URL=http://localhost

    DB_CONNECTION=mysql
    DB_HOST=mysql
    DB_PORT=3306
    DB_DATABASE=homestead
    DB_USERNAME=homestead
    DB_PASSWORD=secret

conf / app.php

conf/app.php

'key' => env('APP_KEY','8TvzjWQxKeDbyPuXFXCY2E0VuFC8vv/+wnGhcU1G4TM='),

behat.yml

   default:
        extensions:
            Laracasts\Behat:
                # env_path: .env.behat
            Behat\MinkExtension:
                default_session: laravel
                base_url: http://localhost:8888
                laravel: ~

在Docker容器中添加了Behat:

I added Behat in docker container with:

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev

vendor/bin/behat --init

当我运行 phpunits 时,我遇到了相同的错误,一个href =https://stackoverflow.com/questions/38043467/phpunit-testing-fails-only-when-visiting-the-root-page-visit-in-laravel/38099968#38099968>问题 。

I had the same error when I ran phpunits but fiksed it in this question.

推荐答案

我认为你不会通过容器运行Behat,它不与mysql容器相关联。
尝试这个

I think you don't run Behat through container and it is not linked with mysql container. Try this

docker-compose run  php php /var/www/html/vendor/bin/behat --init

或类似的东西,以便使用与mysql链接的php容器执行behat

or something similar so that you execute behat using the php container that has linking with mysql

这篇关于Behat,MySql连接错误在Laravel5:'PDOException''SQLSTATE [HY000] [2005]未知MySQL服务器主机'mysql'(2)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆