I have a class FillUserPaymentStatisticService with methods: public function fillStatisticForAllTime(): void { $firstDate = DateTime::createFromFormat(‘Y-m-d H:i:s’, $this->…
Tag: phpunit
Laravel 6 PHPUnit Testing – could not find driver (SQL: PRAGMA foreign_keys = ON;)
I’m started to write tests in Laravel. My application works, I can login, run migrations, but when I’m trying to test the login, I’m getting the following error: could not find driver (SQL: PRAGMA foreign_keys = ON;) My DB is in Postgres, and my test is as follows: I’m not worried (for now) if my test is good enough or
PhpUnit How to test double a method using both other class and self class methods?
So I want to test double my function doEverything like so : class MyClass { protected secondClass; public function __construct( SecondClass $secondClass; ) { $this->…
Bypass SIMPLETEST_BASE_URL in PHPUnit.xml
Is there any way to run PHPUnit test case without SIMPLETEST_BASE_URL. I need to perform PHPUnit in an environment where only PHP cli is availabe. So can’t put any url on SIMPLETEST_BASE_URL in …
Laravel eager loading phpunit testing
I am trying to do a GET request to retrieve a specific film via the id /GET ‘film/{id}’ etc film_table — id — description this is what is part of the response, what if I’ve many-to-many …
How to prevent Laravel event() from firing during unit tests
I have a class that uses Laravel’s global event() function to fire off a single event when a model is changed. The only way I have been able to prevent this event from firing during unit tests is to actually namespace and declare a new event() function in the test itself and make it do nothing. It works, but it
PHpUnit with xdebug Breaks at BaseTestRunner instead of the actual test
I have setup Xdebug remote debugging with the following configuration: I placed a breakpoint in my phpunit test:
Panther Chrome WebDriver : Full screen?
In my functional test of my symfony 4 application, i use the Chrome Webdriver with PANTHER_NO_HEADLESS=1 to see what happen. My problem is : Chrome browser starting with Debug Tool (F12) and not in full screen. This is a problem because i want to test elements that appears only on full screen. My test : Command : Then How can
The Mix manifest does not exist when using orchestral/testbench
Creating a custom Laravel package using the orchestral/testbench package that helps package developer to help with PHPUnit test. So, my package on a different place and not in a Laravel installation exactly. Everything works great except the mix() function that I’m using on the blade view for resources. And, I have the following test route set in the web.php: In
How to assert 2 directories are identical in PHPunit?
I have 2 directories, multiple files, basically text formats. They should be equal. I need to know what files are missing/extra (diff will). What method should I use?