Kodaf Kodaf
8

Laravel PHPUnit test error

I'm follow this series https://laracasts.com/series/build-a-la...
tykus replied
Solved
Testing
8
107
nathangross nathangross
3

Testing with an authenticated user

I'm trying to write a test that needs an authenticated user. The code in question: $this->actingAs($event->user) When I run it, I get the f...
hiteshi hiteshi
1

Best Testing Tips for Your E-Commerce Store

After setting up a convincing eCommerce store, there are many things that you have to address to ensure your store gets a loyal customer following and they keep coming back...
fahaddsheikh fahaddsheikh
7

DB:SEED keeps on going on and does nothing

I've been stuck with this problem for soo loong. It started when I introduced polymorphic relationships for attachments. When I do php artisan db:seed i...
trip.somers trip.somers
3

SoftDeletes + Observer = volatile test?

I have a test that occasionally throws an exception, I'd guess about 3-5% of the time. It appears to be a race condition related to Eloquent model events and an Observer. I...
Testing
3
194
squibby squibby
5

How to update environment/config variable in Cypress?

Is there anyway to set config variables either before or during Cypress tests? It may not be possible but this is what I have tried... I have a some routes like:...
JeroenvanRensen JeroenvanRensen
1

Tinker: "Call to a member function tags() on null" but PHPunit does work

Hi everyone, I am testing my code in Tinker, after it worked in PHPunit. In tinker I got the following error: PHP Error: Call to a member function ta...
rearmustak rearmustak
1

PHPUnit error

I was watching this series. Now after ep02 when I run phpunit i get error but when I...
IvanRadojevic IvanRadojevic
1

error unit test: Unable to locate factory

I use this factory in feauture test and it is working. What is the problem in unit testing? Tests\Unit\ReplyTest::it_has_body InvalidArgumentException: Unable...
Tray2 replied
Solved
nessor nessor
7

Laravel Dusk (php str_contains) line break

Hey guys, I have a problem with the assertSee() function. I want to check if a string from a lang file is visible. The problem is that inside this strin...
Testing
7
103
squibby squibby
2

How to switch .env file when using Cypress?

Hi I am new to Cypress testing framework, I am already very familiar with Laravel Dusk but am now working with Cypress. In Laravel dusk it is possible for the .env.d...
squibby replied
Solved
Testing
2
121
BrownieCoffee BrownieCoffee
14

The current user is not authenticated PHPUnit

Hello guys, are are you? Can you help me to fix this error please? I try since 1 week to fix that but nothing yet. I did test to know if a user can log...
katzda replied
Solved
Testing
14
1182
simioluwatomi simioluwatomi
1

Laravel Passport Trying to get property 'secret' of non-object

In an old laravel project, calling the artisan command to install laravel passport win a Test works like this public $mockConsoleOutput = false; pro...
spacedog4 spacedog4
4

Insert records from different tables with one query

I want to use the bennefit of factories, I'm improving the performance of my tests, today I have more the 400 tests, I need to refresh the database before each...
phpMick phpMick
9

Testing landlord and tenant databases.

Hi, Is anyone running multi-tenant tests? How are you doing this? I am currently using two MySQL databases (landlord and tenant) and want to swap to a...
Testing
9
139

route() does not return the new app.url in my tests

I want to change my app URL when running some of my tests. When I do Config::set('app.url', 'newURL.test'); in my test, the route('something') sti...
RubenSteen RubenSteen
1

PHPUnit / TDD / DRY Concerns

So i've been getting into testing with a few thoughts on how to do this correctly. The whole thing i've been setting aside because of these things so and midway into my Lar...
jgravois jgravois
8

Seeding For PEST Test

I am trying to seed a database table from a JSON file for a specific set of tests. This is the seeder saved in the regular seeds folder (generated by php artis...
TobiasS replied
Solved
Testing
8
164
robertldeboer robertldeboer
8

API Controller Testing

I have used $this->json in the past to test controllers - specifically to write unit test for API controllers. It is simple and when combined with it's othe...
Testing
8
157
ArneDB ArneDB
3

Laravel Dusk runs with old .env params

Hello there, My laravel dusk tests are failing because it keeps using old .env params. I edited my .env.dusk.local with the correct mailtrap parameters and after tha...
ArneDB replied
Solved
Testing
3
123
KevDev KevDev
1

Laravel 7 using codeception with .env.testing

Hey guys. I am really new on codeception and I setup laravel5 module on my laravel7 application and it works but I am facing a problem when I load a .env.testing...

different base URL for testing

I try to use the testing framework of Laravel to test a local website on a different URL: ht...
James_Moore James_Moore
3

When redirecting back after mail sent in test 302 status code

I have the following test /** @test */ public function an_authenticated_user_can_email_an_ad_creator() { // Given \Mail::fake();...
Testing
3
105
schroedingerswg schroedingerswg
3

Laravel cannot find assertDatabaseHas()

Hey there, Laravel cannot find assertDatabaseHas() can anybody help? I followed the doc :...
tykus replied
Solved
Testing
3
102
schroedingerswg schroedingerswg
1

Cannot retrieve One-to-One relation

Hey guys, I'm stuck for some hours now :/ I cannot retrieve a one to one relation for some reason: $user->defaultAddress() and $user->defaultAddress both retur...
SeebeckZachary SeebeckZachary
6

Laravel Dusk and HTTP::mock()

Hey there, so I'm starting to get into testing my Laravel apps, and I've really enjoyed using the mock functions when dealing with external APIs. Now the app that I'm curre...
Testing
6
139
michapietsch michapietsch
11

Subsequent tests to API with token guard do not require Auth header

I'm testing an API with a token guard. When I make a request (this->getJson()), I provide the api token as a Bearer token in the Authorization...
Testing
11
887

SoftDelete & observer

Hello i have this test when and want to make observer to update it /** @test * */ public function it_should_change_status_order_when_traveller_delete_orde...
Testing
3
9545
trevorpan trevorpan
2

"[email protected]"

This has to be the most bizarre behavior I've ever seen. There's no dd() absolutely no reason this should spit out on the command line - but there it is:...
Testing
2
100
b1narylife b1narylife
10

"The table is empty :-("

No sure if I should post it here or create a discussion so apologies if this isn't the right place to do it. Anyway, I am going through build-a-laravel-app-with-tdd...
Testing
10
2462
DavidSprauel DavidSprauel
1

Notification not sent

Hi everyone, I'm building an app in TDD and i'm facing a weird error i've been searching a solution on it since yesterday. In the app, you have the possibilit...
llhilton llhilton
2

Migration for every test?

I've currently got 44 tests (mostly acceptance-test types), and each test is taking several minutes to run. If what I think I'm seeing is what's really going on, phpunit is...
Testing
2
379
Perdanjam Perdanjam
11

Build a Laravel App With TDD - Episode 4, InvalidArgumentException: Unable to locate factory with name [default] [App\Project]

I am deep in bug town here, can anyone help? I am following the tutorial line by line and have got as far as the unit test in the episode:...
Testing
11
1866
stwilson stwilson
4

Testing JSON APIs, specifically: assertJsonStructure

Per the Laravel 5.4 documentation: $response->assertJsonStructure(array $structure); ...should "assert that the response has a given...
Testing
4
7587
ddesyllas ddesyllas
8

Why I am unable to assert that a job has not been dispatched?

I have the following job: namespace App\Jobs; use App\Jobs\AnothertJob; class MyJob implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queu...
Testing
8
324
Create a New Discussion Button