I have a Job that runs each 10 minutes, and is flooding the laravel.log, so I want to log all his activity to /storage/logs/customJob.log
In /config/logging.php, I added a channel:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
// ...
'customJob' => [
'driver' => 'single',
'path' => storage_path('logs/customJob.log'),
'level' => 'info',
]
],
and call it in my job with
Log::channel('customJob')->info("test...");
Weird thing is when I try it with tinker or locally, it works well.
But in production, I can see:
in logs/customJob.log, I can see the logs for 10:30, 11:40, 12:10, seems random.
in logs/laravel.log, I can see:
[2021-05-19 12:40:25] laravel.EMERGENCY: Unable to create configured
logger. Using emergency logger. {"exception":"[object]
(ErrorException(code: 0): Undefined array key \"driver\" at
/home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:195)
[stacktrace]
#0 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(195):
Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(118):
Illuminate\\Log\\LogManager->resolve()
#2 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(98):
Illuminate\\Log\\LogManager->get()
#3 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(87):
Illuminate\\Log\\LogManager->driver()
#4 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261):
Illuminate\\Log\\LogManager->channel()
#5 /home/ubuntu/project/app/Jobs/BlockchainToDb.php(104): Illuminate\\Support\\Facades\\Facade::__callStatic()
#6 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
App\\Jobs\\BlockchainToDb->handle()
#7 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#8 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#9 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#10 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#11 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128):
Illuminate\\Container\\Container->call()
#12 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#13 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132):
Illuminate\\Pipeline\\Pipeline->then()
#15 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118):
Illuminate\\Bus\\Dispatcher->dispatchNow()
#16 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#17 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120):
Illuminate\\Pipeline\\Pipeline->then()
#19 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70):
Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#20 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98):
Illuminate\\Queue\\CallQueuedHandler->call()
#21 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(410):
Illuminate\\Queue\\Jobs\\Job->fire()
#22 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360):
Illuminate\\Queue\\Worker->process()
#23 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158):
Illuminate\\Queue\\Worker->runJob()
#24 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117):
Illuminate\\Queue\\Worker->daemon()
#25 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101):
Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#26 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
Illuminate\\Queue\\Console\\WorkCommand->handle()
#27 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#29 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#30 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#31 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(136):
Illuminate\\Container\\Container->call()
#32 /home/ubuntu/project/vendor/symfony/console/Command/Command.php(256):
Illuminate\\Console\\Command->execute()
#33 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(121):
Symfony\\Component\\Console\\Command\\Command->run()
#34 /home/ubuntu/project/vendor/symfony/console/Application.php(971):
Illuminate\\Console\\Command->run()
#35 /home/ubuntu/project/vendor/symfony/console/Application.php(290):
Symfony\\Component\\Console\\Application->doRunCommand()
#36 /home/ubuntu/project/vendor/symfony/console/Application.php(166):
Symfony\\Component\\Console\\Application->doRun()
#37 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Application.php(92):
Symfony\\Component\\Console\\Application->run()
#38 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129):
Illuminate\\Console\\Application->run()
#39 /home/ubuntu/project/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#40 {main} "}
I can see those warning for all the missing timestamps in customJob.log ie 10:40, 10:50, 11:00, 11:10, 11:20, 11:30, 11:50, etc.
Where BlockchainToDb.php(104) correspond to:
Log::channel('customJob')->info("Skipping...");
I also took care of cleaning cache, config, views and route in production:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
Why is it behaving this way ???
I have been stuck on Laravel Passport issue for 4 days now.
Following is my code base to verify login credentials and thus verify user login (token based)
I have followed all the steps for Passport integration.
API I call (From Postman):
http://localhost/oauth/token/?email=admin#test.com&password=Abcd#123&grant_type=password&client_id=10&client_secret=xqVaBzFyC2fVDwyd6Pk7nsy2o45GfYAgUKeR2OjK&scope=*
i.e.
email:admin#test.com
password:Abcd#123
grant_type:password
client_id:3
client_secret:xqVaBsdfsdfsf42fso45GfYAgUKeR2OjK
scope:*
config/auth.php
'defaults' => [
'guard' => 'api',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
But I am getting the error :
{
"error": "unsupported_grant_type",
"message": "The authorization grant type is not supported by the authorization server.",
"hint": "Check the `grant_type` parameter"
}
Error I received
[2017-03-08 12:12:10] local.ERROR: League\OAuth2\Server\Exception\OAuthServerException: The authorization grant type is not supported by the authorization server. in /var/www/html/test/testProj/Proj_Latest/vendor/league/oauth2-server/src/Exception/OAuthServerException.php:65
Stack trace:
#0 /var/www/html/test/testProj/Proj_Latest/vendor/league/oauth2-server/src/AuthorizationServer.php(204): League\OAuth2\Server\Exception\OAuthServerException::unsupportedGrantType()
#1 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(63): League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#2 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/HandlesOAuthErrors.php(25): Laravel\Passport\Http\Controllers\AccessTokenController->Laravel\Passport\Http\Controllers\{closure}()
#3 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(64): Laravel\Passport\Http\Controllers\AccessTokenController->withErrorHandling(Object(Closure))
#4 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(47): Laravel\Passport\Http\Controllers\AccessTokenController->issueToken(Object(Zend\Diactoros\ServerRequest))
#5 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Laravel\Passport\Http\Controllers\AccessTokenController), 'issueToken')
#6 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\Routing\Route->runController()
#7 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(559): Illuminate\Routing\Route->run()
#8 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#9 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#10 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure))
#11 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#12 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#13 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(561): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#14 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(520): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#15 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(498): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#16 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(174): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#17 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#18 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/ResponseLogger.php(22): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#19 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\ResponseLogger->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/RequestLogger.php(45): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#22 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\RequestLogger->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/Cors.php(18): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#25 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#46 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(149): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#47 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#48 /var/www/html/test/testProj/Proj_Latest/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#49 {main}
Now since this did not work, I tried the method :
Auth::attempt(array('email' => 'admin#test.com', 'password' => 'Abcd#123'))
But this time I received :
[2017-03-08 12:00:00] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Auth\RequestGuard::attempt() in /var/www/html/..../vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:294
Nothing seems to be working in Laravel 5.4
First of all, make sure that the grant client is a 'password client', creaded similiarly as with the command:
php artisan passport:client --password
This means that the 'password_client' column in the database has the value '1' next to the corresponding client.
I also struggled a lot with the default user clients created from the user interface, and it doesn't work with those.
I run Laravel applic ation in docker container dockervel and
the test
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware ;
use Illuminate\Foundation\Testing\DatabaseMigrations ;
use Illuminate\Foundation\Testing\DatabaseTransactions ;
use App\User1;
class MyTest extends TestCase
{
public function testExample()
{
$this->assertTrue(true);
}
public function providerAllUrisWithResponseCode()
{
return [
['/', 200],
['/thank', 200],
['/non-existing', 404],
];
}
public function testDisplayThankYou($value='')
{
$this->visit('/thankyou')
->see('THank you!');
}
public function testNewUserRegistration()
{
$this->visit('/')
->type('Taylor', 'name')
->type('taylor#talor.com', 'email')
->press('Register')
->seePageIs('/thankyou');
}
public function testPageControllerGet()
{
$this->call('GET', '/');
}
public function testPageControllerGettoThankYou()
{
$this->call('GET', 'thankyou');
}
public function testUser1ControllerPost()
{
$response= $this->call('POST', '/');
}
}
IT FAILS ONLY on method testNewUserRegistration when $this->visit('/') it says:
There was 1 failure:
1) MyTest::testDisplayWelcome
A request to [http://localhost] failed. Received status code [500].
Caused by
exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' in ..vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
Note:Can into database thru my app.
laravel.log:
[2016-06-27 09:02:53] testing.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' in ../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
Stack trace:
#0 ../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=mysq...', 'homestead', 'secret', Array)
#1 ../vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=mysq...', Array, Array)
#2 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(908): call_user_func(Object(Closure))
#5 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\Database\Connection->getPdo()
#6 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(661): Illuminate\Database\Connection->reconnectIfMissingConnection()
#7 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#8 ../vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1583): Illuminate\Database\Connection->select('select * from `...', Array, true)
#9 ../vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1569): Illuminate\Database\Query\Builder->runSelect()
#10 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(624): Illuminate\Database\Query\Builder->get(Array)
#11 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(316): Illuminate\Database\Eloquent\Builder->getModels(Array)
#12 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(649): Illuminate\Database\Eloquent\Builder->get(Array)
#13 ../app/Http/Controllers/PageController.php(14): Illuminate\Database\Eloquent\Model::all()
#14 [internal function]: App\Http\Controllers\PageController->home()
#15 ../vendor/laravel/framework/src/Illuminate/Routing/Controller.php(80): call_user_func_array(Array, Array)
#16 ../vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(146): Illuminate\Routing\Controller->callAction('home', Array)
#17 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 ../vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(96): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Route.php(174): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\\Http\\Contro...', 'home')
#25 ../vendor/laravel/framework/src/Illuminate/Routing/Route.php(140): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
#26 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#29 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#39 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#44 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#49 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#56 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#57 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(699): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#58 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#59 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#62 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#69 ../vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#70 ../vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#71 ../vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php(515): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#72 ../vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php(78): Illuminate\Foundation\Testing\TestCase->call('GET', 'http://localhos...', Array, Array, Array)
#73 ../vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php(61): Illuminate\Foundation\Testing\TestCase->makeRequest('GET', '/')
#74 ../tests/MyTest.php(38): Illuminate\Foundation\Testing\TestCase->visit('/')
#75 [internal function]: MyTest->testNewUserRegistration()
#76 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(909): ReflectionMethod->invokeArgs(Object(MyTest), Array)
#77 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(768): PHPUnit_Framework_TestCase->runTest()
#78 ../vendor/phpunit/phpunit/src/Framework/TestResult.php(612): PHPUnit_Framework_TestCase->runBare()
#79 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(724): PHPUnit_Framework_TestResult->run(Object(MyTest))
#80 ../vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#81 ../vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#82 ../vendor/phpunit/phpunit/src/TextUI/TestRunner.php(440): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#83 ../vendor/phpunit/phpunit/src/TextUI/Command.php(149): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#84 ../vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(Array, true)
#85 ../vendor/phpunit/phpunit/phpunit(47): PHPUnit_TextUI_Command::main()
#86 {main}
[2016-06-27 09:03:05] testing.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' in ../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
Stack trace:
#0 ../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=mysq...', 'homestead', 'secret', Array)
#1 ../vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=mysq...', Array, Array)
#2 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(908): call_user_func(Object(Closure))
#5 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\Database\Connection->getPdo()
#6 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(661): Illuminate\Database\Connection->reconnectIfMissingConnection()
#7 ../vendor/laravel/framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#8 ../vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1583): Illuminate\Database\Connection->select('select * from `...', Array, true)
#9 ../vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1569): Illuminate\Database\Query\Builder->runSelect()
#10 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(624): Illuminate\Database\Query\Builder->get(Array)
#11 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(316): Illuminate\Database\Eloquent\Builder->getModels(Array)
#12 ../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(649): Illuminate\Database\Eloquent\Builder->get(Array)
#13 ../app/Http/Controllers/PageController.php(14): Illuminate\Database\Eloquent\Model::all()
#14 [internal function]: App\Http\Controllers\PageController->home()
#15 ../vendor/laravel/framework/src/Illuminate/Routing/Controller.php(80): call_user_func_array(Array, Array)
#16 ../vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(146): Illuminate\Routing\Controller->callAction('home', Array)
#17 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 ../vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(96): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Route.php(174): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\\Http\\Contro...', 'home')
#25 ../vendor/laravel/framework/src/Illuminate/Routing/Route.php(140): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
#26 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#29 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#39 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#44 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#49 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#56 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#57 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(699): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#58 ../vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#59 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#62 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/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 ../vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#69 ../vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#70 ../vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#71 ../vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php(515): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#72 ../tests/MyTest.php(47): Illuminate\Foundation\Testing\TestCase->call('GET', '/')
#73 [internal function]: MyTest->testPageControllerGet()
#74 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(909): ReflectionMethod->invokeArgs(Object(MyTest), Array)
#75 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(768): PHPUnit_Framework_TestCase->runTest()
#76 ../vendor/phpunit/phpunit/src/Framework/TestResult.php(612): PHPUnit_Framework_TestCase->runBare()
#77 ../vendor/phpunit/phpunit/src/Framework/TestCase.php(724): PHPUnit_Framework_TestResult->run(Object(MyTest))
#78 ../vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#79 ../vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#80 ../vendor/phpunit/phpunit/src/TextUI/TestRunner.php(440): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#81 ../vendor/phpunit/phpunit/src/TextUI/Command.php(149): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#82 ../vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(Array, true)
#83 ../vendor/phpunit/phpunit/phpunit(47): PHPUnit_TextUI_Command::main()
#84 {main}
My:
.env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
config/database.php
<?php
return [
'fetch' => PDO::FETCH_CLASS,
'default' => env('DB_CONNECTION', 'mysql'),
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'mysql'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
],
'migrations' => 'migrations',
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<exclude>
<file>./app/Http/routes.php</file>
</exclude>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_HOST" value="mysql"/>
<env name="DB_USERNAME" value="homestead"/>
<env name="DB_PASSWORD" value="secret"/>
</php>
</phpunit>
Please help!
try an other version much easier. It is based in PHP 7 and is ready to run phpunit tests in one comand dunit
$ dstop
$ git checkout builder
$ . ./aliases.sh
$ dup
$ dunit
I think there are 2 things happening in your code snippet.
The first thing is that you are defining the host as mysql, not the driver (which i think is the one you are trying to set). Try setting the environment variable DB_CONNECTION to mysql instead of DB_HOST.
The second thing is that you need to add the DatabaseMigrations trait to your test class, try adding this:
<?php
// Imports
class MyTest extends TestCase {
use DatabaseMigrations; // This line
...
}
Without this your tests will probably fail as it will find the database, but it won't find any tables created inside it.
Hope it helps.
EDIT
Best practice for testing is to either mock dependencies that need to communicate with the database, or use an in-memory database for your tests to separate them from your real database.
In order to separate your testing database from your real database, you could use the sqlite driver in memory. Just update your sqlite driver in your database.php file like this:
'sqlite' => [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
],
And use it as the DB_CONNECTION environment variable in your tests (modifying phpunit.xml):
<env name="DB_CONNECTION" value="sqlite"/>
try this:
see if mysql container is up:
docker ps
You should see a mysql container. If not then run dstop & dup
I've spent all night trying different things and for the life of me I cannot get my site to send emails. I just deployed my first Laravel project to a live server (digitalocean), yet when on my vagrant dev machine I have no problems sending email, it isn't until I deploy that the problems began.
I know the 500 error is usually due to the CSRF tokens and passing them in your headers, but I am doing that and am still getting an error. I will post the code I assume would be relevant and if anyone can see what the hell I am doing wrong I will forever be in your debt.
MAIL: (Asterix for privacy)
return [
'driver' => 'smtp',
'host' => 'smtp.mandrillapp.com',
'port' => 587,
'from' => array('address' => '********#gmail.com', 'name' => 'Admin'),
'encryption' => 'tls',
'username' => '********#gmail.com',
'password' => '****************',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
HomeController #store method for email sending (works on dev)
public function store(ContactFormRequest $request)
{
Mail::send('emails.email', array(
'name' => $request->get('name'),
'email' => $request->get('email'),
'user_message' => $request->get('user_message')
), function($message)
{
$message->from('*********#gmail.com');
$message->to('********#gmail.com', 'Admin')->subject('Client Inquiry');
});
return Response::json(['response' => 200]);
}
AJAX (jQuery)
$('#submit-contact-form').click(function(e) {
e.preventDefault();
$('#submit-contact-form').val('Sending...');
var $form = $(this).parent('form');
var $action = $form.attr('action');
var $data = $form.serialize();
$.ajax({
url: $action,
method: 'POST',
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') },
data: $data,
success: function(data) {
if (data.response == 200) {
$('#submit-contact-form').val('Thank You For Contacting Us!');
}
}
});
});
Routes.php: (contact form is on my homepage and posts to itself, works on dev)
Route::resource('/', 'HomeController', ['only' => ['index','store']]);
Finally Form: (discovered if posting to root, for the url you have to pass empty string with a space in it
{!! Form::open(array('url' => ' ', 'id' => 'contact-form')) !!}
blah blah blah
{!! Form::close() !!}
I am new to Laravel so i'm still learning, but this one has me stuck especially because it works on dev and not production.
Here is my error log:
[2015-05-14 06:29:01] production.ERROR: exception 'ErrorException' with message 'Missing argument 1 for Illuminate\Support\Manager::createDriver(), called in /var/www/html/kraken/vendor/compiled.php on line 11268 and defined' in /var/www/html/kraken/vendor/compiled.php:11262
Stack trace:
#0 /var/www/html/kraken/vendor/compiled.php(11262): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Missing argumen...', '/var/www/html/k...', 11262, Array)
#1 /var/www/html/kraken/vendor/compiled.php(11268): Illuminate\Support\Manager->createDriver()
#2 /var/www/html/kraken/vendor/compiled.php(11258): Illuminate\Support\Manager->createDriver(NULL)
#3 /var/www/html/kraken/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php(92): Illuminate\Support\Manager->driver()
#4 /var/www/html/kraken/vendor/compiled.php(827): Illuminate\Mail\MailServiceProvider->Illuminate\Mail\{closure}(Object(Illuminate\Foundation\Application))
#5 /var/www/html/kraken/vendor/compiled.php(1027): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#6 /var/www/html/kraken/vendor/compiled.php(980): Illuminate\Container\Container->build(Object(Closure), Array)
#7 /var/www/html/kraken/vendor/compiled.php(1493): Illuminate\Container\Container->make('swift.mailer', Array)
#8 /var/www/html/kraken/vendor/compiled.php(1213): Illuminate\Foundation\Application->make('swift.mailer')
#9 /var/www/html/kraken/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php(30): Illuminate\Container\Container->offsetGet('swift.mailer')
#10 /var/www/html/kraken/vendor/compiled.php(1027): Illuminate\Mail\MailServiceProvider->Illuminate\Mail\{closure}(Object(Illuminate\Foundation\Application), Array)
#11 /var/www/html/kraken/vendor/compiled.php(980): Illuminate\Container\Container->build(Object(Closure), Array)
#12 /var/www/html/kraken/vendor/compiled.php(1493): Illuminate\Container\Container->make('mailer', Array)
#13 /var/www/html/kraken/vendor/compiled.php(1213): Illuminate\Foundation\Application->make('mailer')
#14 /var/www/html/kraken/vendor/compiled.php(5276): Illuminate\Container\Container->offsetGet('mailer')
#15 /var/www/html/kraken/vendor/compiled.php(5262): Illuminate\Support\Facades\Facade::resolveFacadeInstance('mailer')
#16 /var/www/html/kraken/vendor/compiled.php(5296): Illuminate\Support\Facades\Facade::getFacadeRoot()
#17 /var/www/html/kraken/app/Http/Controllers/HomeController.php(28): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#18 /var/www/html/kraken/app/Http/Controllers/HomeController.php(28): Illuminate\Support\Facades\Mail::send('emails.email', Array, Object(Closure))
#19 [internal function]: App\Http\Controllers\HomeController->store(Object(App\Http\Requests\ContactFormRequest))
#20 /var/www/html/kraken/vendor/compiled.php(8287): call_user_func_array(Array, Array)
#21 /var/www/html/kraken/vendor/compiled.php(8354): Illuminate\Routing\Controller->callAction('store', Array)
#22 /var/www/html/kraken/vendor/compiled.php(8333): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\HomeController), Object(Illuminate\Routing\Route), 'store')
#23 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#25 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#27 /var/www/html/kraken/vendor/compiled.php(8334): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#28 /var/www/html/kraken/vendor/compiled.php(8320): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\HomeController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'store')
#29 /var/www/html/kraken/vendor/compiled.php(7317): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'store')
#30 /var/www/html/kraken/vendor/compiled.php(7288): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#31 /var/www/html/kraken/vendor/compiled.php(6954): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#32 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#36 /var/www/html/kraken/vendor/compiled.php(6955): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#37 /var/www/html/kraken/vendor/compiled.php(6944): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#38 /var/www/html/kraken/vendor/compiled.php(6929): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#39 /var/www/html/kraken/vendor/compiled.php(1935): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#40 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#41 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#42 /var/www/html/kraken/vendor/compiled.php(2438): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/kraken/app/Http/Middleware/VerifyCsrfToken.php(17): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /var/www/html/kraken/vendor/compiled.php(8944): App\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /var/www/html/kraken/vendor/compiled.php(12083): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /var/www/html/kraken/vendor/compiled.php(10785): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /var/www/html/kraken/vendor/compiled.php(11789): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#50 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /var/www/html/kraken/vendor/compiled.php(11738): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /var/www/html/kraken/vendor/compiled.php(2478): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#54 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#55 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#56 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#57 /var/www/html/kraken/vendor/compiled.php(1891): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#58 /var/www/html/kraken/vendor/compiled.php(1880): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#59 /var/www/html/kraken/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#60 {main}
I've already gone to Laracast and posted but didn't get any responses, if anyone can help me I would appreciate it so much, thanks guys.