skip to Main Content

Mysql function fails in Laravel tests

I have a query below that retrieves groups from the database; it works fine except when I run it through pest php test case and hit the controller; the test fails and says IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such…

VIEW QUESTION

Mocking laravel models static call

Background I have a system with a microservices setup. A few of these microservices run a laravel installation. In order to share some key models, a repo was shared using git/packagist. Here is a diagram: Microservice A Microservice B ...…

VIEW QUESTION

Laravel parallel test cant create the database

I am trying to run laravel feature tests in parallel mode as it is in document. My phpunit.xml is configed as below : <php> <env name="APP_ENV" value="testing"/> <env name="BCRYPT_ROUNDS" value="4"/> <env name="CACHE_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/> <env name="QUEUE_DRIVER" value="sync"/> <env…

VIEW QUESTION

PHPUnit simple method to compare two dates

I'm not familiar with PHPUnit and just want to execute a simple method that return a DateTimeImmutable and compare it with another DateTimeImmutable. public function testGetLunchTimesBeginHour() { $minLunchTime = DateTimeImmutable::createFromFormat('H:i', self::MIN_BEGIN_LUNCH); $maxLunchTime = DateTimeImmutable::createFromFormat('H:i', self::MAX_END_LUNCH); foreach($this->daysOfAppointments as $dayOfAppointments){ $appointments =…

VIEW QUESTION

assertSee failed due to whitespaces in html code – Laravel

In my blade, I have a button: <a href="/customer/member/delete/{{ $member->id }}" class="btn btn-secondary delete-button" > Delete </a> And I want to test it: $this->view->assertSee('<a href="/customer/member/delete/1" class="btn btn-secondary delete-button">Delete</a>'); How can I ignore whitespaces in the test? A tried: trim and…

VIEW QUESTION
Back To Top
Search