Symfony 4.1 phpunit 6.5 показывает перехваченные исключения на консоли с помощью webtestcase

Я использую Symfony 4.1 WebTestCase и phpunit 6.5 для проверки того, что несуществующий пользователь не может регистрировать использование аутентификации Symfony для базы данных.

Я думаю, что phpunit НЕ должен показывать никаких ошибок, но он пишет в консоли много исключения, так как на выходе много неважных исключения, поскольку они были пойманы правильно.

Кроме того, assertNotEquals также генерирует исключение сравнения !!

Пожалуйста, если кто-нибудь может объяснить мне, как это исправить. Я уже несколько дней безуспешен.

Мой код выглядит следующим образом (извините, мой первый вопрос в этой сети):

//------------------ REQUEST FOR PAGE LOGIN
$crawler = $client->request('GET', $url_login);

//------------------ (SOM NOT IMPORTANT STAFF AND REDIRECTION)
$crawler = $client->submit($form);

//------------------ SENDING INCORRECT LOGIN USER
$form = $crawler->filter('.btn.btn-primary.btn-block')->form();
// set some values
$form['_username'] = 'failed_user';
$form['_password'] = 'failed_password';

//------------------ ALL IS OK SINCE HERE


//------------------ THIS SHOWS 
//UsernameNotFoundException ON CONSOLE BUT EXCEPTION HAS BEEN CATCHED 
//AND FORM RETURNED OK SAYING "This user doesn't exist"

$crawler = $client->submit($form);

//------------------ THIS SHOW 
// SebastianBergmann\Comparator\ComparisonFailure:  Failed asserting that two strings are equal...
//ON CONSOLE !!

$this->assertNotEquals($url_login, $url_resp, 'La página de login no es la esperada al identificarnos correctamente');

А консоль такая:

esteban@linux-9j0e:~/workspace_newproject/mywebproject> bin/phpunit 
#!/usr/bin/env php
PHPUnit 6.5.11 by Sebastian Bergmann and contributors.

Testing Project Test Suite
PHP Symfony\Component\Security\Core\Exception\UsernameNotFoundException:  User "esteban_fail" not found. in /home/esteban/workspace_newproject/mywebproject/vendor/symfony/doctrine-bridge/Security/User/EntityUserProvider.php on line 61
PHP Stack trace:
PHP   1. {main}() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:0
PHP   2. require() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:18
PHP   3. include() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/phpunit-bridge/bin/simple-phpunit:260
PHP   4. PHPUnit\TextUI\Command::main() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/phpunit:17
PHP   5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
PHP   6. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
PHP   7. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:546
PHP   8. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP   9. App\Tests\Controller\Security\Login\LoginControllerTest->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP  10. PHPUnit\Framework\TestResult->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:894
PHP  11. App\Tests\Controller\Security\Login\LoginControllerTest->runBare() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:698
PHP  12. App\Tests\Controller\Security\Login\LoginControllerTest->runTest() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:939
PHP  13. ReflectionMethod->invokeArgs() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  14. App\Tests\Controller\Security\Login\LoginControllerTest->testshowLoginFails() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  15. Symfony\Bundle\FrameworkBundle\Client->submit() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Security/Login/LoginControllerTest.php:96
PHP  16. Symfony\Bundle\FrameworkBundle\Client->request() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:298
PHP  17. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:351
PHP  18. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/framework-bundle/Client.php:131
PHP  19. App\Kernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Client.php:68
PHP  20. Symfony\Component\HttpKernel\HttpKernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Kernel.php:188
PHP  21. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:66
PHP  22. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:125
PHP  23. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:141
PHP  24. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:44
PHP  25. Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:212
PHP  26. call_user_func:{/home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104}() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  27. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  28. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48
PHP  29. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->handleRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall.php:61
PHP  30. Symfony\Bundle\SecurityBundle\Debug\WrappedListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35
PHP  31. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/WrappedListener.php:46
PHP  32. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->attemptAuthentication() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/AbstractAuthenticationListener.php:128
PHP  33. Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:100
PHP  34. Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/AuthenticationProviderManager.php:76
PHP  35. Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider->retrieveUser() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/Provider/UserAuthenticationProvider.php:64
PHP  36. Symfony\Bridge\Doctrine\Security\User\EntityUserProvider->loadUserByUsername() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/Provider/DaoAuthenticationProvider.php:74
PHP Symfony\Component\Security\Core\Exception\UsernameNotFoundException:  User "esteban_fail" not found. in /home/esteban/workspace_newproject/mywebproject/vendor/symfony/doctrine-bridge/Security/User/EntityUserProvider.php on line 61
PHP Stack trace:
PHP   1. {main}() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:0
PHP   2. require() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:18
PHP   3. include() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/phpunit-bridge/bin/simple-phpunit:260
PHP   4. PHPUnit\TextUI\Command::main() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/phpunit:17
PHP   5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
PHP   6. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
PHP   7. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:546
PHP   8. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP   9. App\Tests\Controller\Security\Login\LoginControllerTest->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP  10. PHPUnit\Framework\TestResult->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:894
PHP  11. App\Tests\Controller\Security\Login\LoginControllerTest->runBare() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:698
PHP  12. App\Tests\Controller\Security\Login\LoginControllerTest->runTest() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:939
PHP  13. ReflectionMethod->invokeArgs() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  14. App\Tests\Controller\Security\Login\LoginControllerTest->testshowLoginFails() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  15. Symfony\Bundle\FrameworkBundle\Client->submit() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Security/Login/LoginControllerTest.php:96
PHP  16. Symfony\Bundle\FrameworkBundle\Client->request() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:298
PHP  17. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:351
PHP  18. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/framework-bundle/Client.php:131
PHP  19. App\Kernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Client.php:68
PHP  20. Symfony\Component\HttpKernel\HttpKernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Kernel.php:188
PHP  21. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:66
PHP  22. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:125
PHP  23. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:141
PHP  24. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:44
PHP  25. Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:212
PHP  26. call_user_func:{/home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104}() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  27. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  28. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48
PHP  29. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->handleRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall.php:61
PHP  30. Symfony\Bundle\SecurityBundle\Debug\WrappedListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35
PHP  31. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/WrappedListener.php:46
PHP  32. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->attemptAuthentication() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/AbstractAuthenticationListener.php:128
PHP  33. Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:100
PHP  34. Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/AuthenticationProviderManager.php:76
PHP  35. Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider->retrieveUser() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/Provider/UserAuthenticationProvider.php:64
PHP Symfony\Component\Security\Core\Exception\BadCredentialsException:  Bad credentials. in /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/Provider/UserAuthenticationProvider.php on line 67
PHP Stack trace:
PHP   1. {main}() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:0
PHP   2. require() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:18
PHP   3. include() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/phpunit-bridge/bin/simple-phpunit:260
PHP   4. PHPUnit\TextUI\Command::main() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/phpunit:17
PHP   5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
PHP   6. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
PHP   7. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:546
PHP   8. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP   9. App\Tests\Controller\Security\Login\LoginControllerTest->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP  10. PHPUnit\Framework\TestResult->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:894
PHP  11. App\Tests\Controller\Security\Login\LoginControllerTest->runBare() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:698
PHP  12. App\Tests\Controller\Security\Login\LoginControllerTest->runTest() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:939
PHP  13. ReflectionMethod->invokeArgs() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  14. App\Tests\Controller\Security\Login\LoginControllerTest->testshowLoginFails() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  15. Symfony\Bundle\FrameworkBundle\Client->submit() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Security/Login/LoginControllerTest.php:96
PHP  16. Symfony\Bundle\FrameworkBundle\Client->request() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:298
PHP  17. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:351
PHP  18. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/framework-bundle/Client.php:131
PHP  19. App\Kernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Client.php:68
PHP  20. Symfony\Component\HttpKernel\HttpKernel->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/Kernel.php:188
PHP  21. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:66
PHP  22. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/http-kernel/HttpKernel.php:125
PHP  23. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:141
PHP  24. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:44
PHP  25. Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/EventDispatcher.php:212
PHP  26. call_user_func:{/home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104}() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  27. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  28. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48
PHP  29. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->handleRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall.php:61
PHP  30. Symfony\Bundle\SecurityBundle\Debug\WrappedListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35
PHP  31. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/WrappedListener.php:46
PHP  32. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->attemptAuthentication() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/AbstractAuthenticationListener.php:128
PHP  33. Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:100
PHP  34. Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/AuthenticationProviderManager.php:76
PHP Symfony\Component\Security\Core\Exception\BadCredentialsException:  Bad credentials. in /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Core/Authentication/Provider/UserAuthenticationProvider.php on line 67
PHP Stack trace:
PHP   1. {main}() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:0
PHP   2. require() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:18
PHP   3. include() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/phpunit-bridge/bin/simple-phpunit:260
PHP   4. PHPUnit\TextUI\Command::main() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/phpunit:17
PHP   5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
PHP   6. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
PHP   7. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:546
PHP   8. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP   9. App\Tests\Controller\Security\Login\LoginControllerTest->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP  10. PHPUnit\Framework\TestResult->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:894
PHP  11. App\Tests\Controller\Security\Login\LoginControllerTest->runBare() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:698
PHP  12. App\Tests\Controller\Security\Login\LoginControllerTest->runTest() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:939
PHP  13. ReflectionMethod->invokeArgs() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  14. App\Tests\Controller\Security\Login\LoginControllerTest->testshowLoginFails() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  15. Symfony\Bundle\FrameworkBundle\Client->submit() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Security/Login/LoginControllerTest.php:96
PHP  16. Symfony\Bundle\FrameworkBundle\Client->request() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:298
PHP  17. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/browser-kit/Client.php:351
PHP  18. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/framework-bundle/Client.php:131

(...sorry, cut by putting too long text..)

PHP  26. call_user_func:{/home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104}() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  27. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
PHP  28. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->onKernelRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48
PHP  29. Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->handleRequest() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall.php:61
PHP  30. Symfony\Bundle\SecurityBundle\Debug\WrappedListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35
PHP  31. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->handle() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security-bundle/Debug/WrappedListener.php:46
PHP  32. Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener->attemptAuthentication() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/AbstractAuthenticationListener.php:128
PHP  33. Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager->authenticate() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:100
.PHP SebastianBergmann\Comparator\ComparisonFailure:  Failed asserting that two strings are equal. in /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/vendor/sebastian/comparator/src/ScalarComparator.php on line 67
PHP Stack trace:
PHP   1. {main}() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:0
PHP   2. require() /home/esteban/workspace_newproject/mywebproject/bin/phpunit:18
PHP   3. include() /home/esteban/workspace_newproject/mywebproject/vendor/symfony/phpunit-bridge/bin/simple-phpunit:260
PHP   4. PHPUnit\TextUI\Command::main() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/phpunit:17
PHP   5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
PHP   6. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
PHP   7. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:546
PHP   8. PHPUnit\Framework\TestSuite->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP   9. App\Tests\Controller\Admin\Security\Enteprises\AdminEnterprisesControllerTest->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:755
PHP  10. PHPUnit\Framework\TestResult->run() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:894
PHP  11. App\Tests\Controller\Admin\Security\Enteprises\AdminEnterprisesControllerTest->runBare() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:698
PHP  12. App\Tests\Controller\Admin\Security\Enteprises\AdminEnterprisesControllerTest->runTest() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:939
PHP  13. ReflectionMethod->invokeArgs() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  14. App\Tests\Controller\Admin\Security\Enteprises\AdminEnterprisesControllerTest->test_Add_Edit_And_Delete_Grouper() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/TestCase.php:1071
PHP  15. App\Tests\Controller\Security\Login\LoginControllerTest->ht_return_Logged_User_Client() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Admin/Security/Enterprises/AdminEnterprisesControllerTest.php:121
PHP  16. PHPUnit\Framework\Assert::assertNotEquals() /home/esteban/workspace_newproject/mywebproject/tests/Controller/Security/Login/LoginControllerTest.php:52
PHP  17. PHPUnit\Framework\Assert::assertThat() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/Assert.php:592
PHP  18. PHPUnit\Framework\Constraint\LogicalNot->evaluate() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/Assert.php:2116
PHP  19. PHPUnit\Framework\Constraint\IsEqual->evaluate() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/Constraint/LogicalNot.php:116
PHP  20. SebastianBergmann\Comparator\ScalarComparator->assertEquals() /home/esteban/workspace_newproject/mywebproject/bin/.phpunit/phpunit-6.5/src/Framework/Constraint/IsEqual.php:129
.                                                               5 / 5 (100%)

Time: 1.44 seconds, Memory: 34.00MB

OK (5 tests, 70 assertions)

Remaining deprecation notices (1)

1x: Doctrine\Common\ClassLoader is deprecated.
    1x in LoginControllerTest::testshowLoginFails from App\Tests\Controller\Security\Login

Что вы делаете в своем операторе catch, когда перехватываете UsernameNotFoundException или BadCredentialsException? Вы просто бросаете их снова? Вы также можете использовать аннотацию @ExpectedException над тестом, чтобы показать, что вы ожидаете возникновения определенного исключения.

Dirk Scholten 10.08.2018 17:00

Спасибо. Я в отпуске на две недели. Я протестирую это, когда вернусь к работе. Спасибо большое.

Esteban 14.08.2018 10:31

Здравствуй. Вернулся из отпуска: D. Я не могу выполнить что-либо, так как обработчик выхода из системы является внутренним из symfony, поэтому у меня нет возможности перехватить исключение, как если бы вы в стеке не вызывали собственный код, весь код взят из пути поставщика.

Esteban 07.09.2018 11:31

Так вы не тестируете свой собственный код? На самом деле вы не должны писать тесты для кода, который вы не можете контролировать. Это побеждает цель. Позвольте Symfony позаботиться о своем собственном тестовом коде, а вы пишете тесты для кода, который вы пишете. Издевайтесь над чем-нибудь еще. Так что, если ваш код использует сервис Symfony, имитируйте его и не тестируйте.

Dirk Scholten 07.09.2018 14:27

Привет, спасибо за ответ. Я хотел проверить, правильно ли настроена служба входа в систему, поскольку «служба входа в систему» ​​правильно перенаправляет на мою страницу пользователя или запускает обработчик onAuthenticationFailure, который возвращает страницу входа с сообщением «ошибка в учетных записях», но я не знаю, как чтобы поймать исключение и не отправляться на phpunit. Я знаю только один способ сделать это - отправить неверные учетные данные. И мне очень жаль, но я не понимаю, как имитировать службу, я прочитал документацию по phpunit, но мне это непонятно, так как я только начал работать с phpunit. Я все еще об этом узнаю.

Esteban 09.09.2018 10:07
0
5
332
0

Другие вопросы по теме