Unable to test BelongsToMany relationships

I'm working with a ProfileFactory that randomly attaches BelongsToMany relationships which works great when seeding the database. It also works fine when running the factor...
Zhen replied
Solved
b1narylife b1narylife
12

"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
12
3102
mstdmstd mstdmstd
1

How with http-tests make tests on ajax event with form opened?

Hello, In laravel 6 / bootstrap 4 / jquery: 3.3.1 app I make http-tests with methods in...
nategg nategg
5

Pass variable to factory, Laravel 8, not working

Trying to pass a variable from DatabaseSeeder to factory in Laravel 8; is there new syntax? I need to loop thru my users with foreach. I see a bunch of examples of p...
Testing
5
158
ThetNweEaint ThetNweEaint
2

Laravel PHPUnit Testing

λ phpunit --filter a_thread_has_a_creator PHPUnit 9.4.0 by Sebastian Bergmann and contributors. E...
lianmaymesi lianmaymesi
4

Unknown formatter "name"

I have an error while testing. Below are the code and error. `public function definition() { return [ 'name' => $name = $this->faker...
Testing
4
124

Debug PHPUnit tests that only fail occasionally based on factory data

Hi there, I'm working with a financial application that basically accepts inputs from a user, does some calculations, and spits back "scenarios", think fin...
bt3 replied
Solved
t0berius t0berius
3

laravel factory design question

I'm using a "level" system inside my laravel application. The UserLevelfFactory namespace Database\Factories; use App\Affiliat...
Testing
3
129
keizah keizah
9

SQLite foreign key dont set null on delete in phpunit test

Hello, I have migration where I add foreign key to threads table (...
Testing
9
1707
knubbe knubbe
9

Dusk assert see string in datatables record

How to test in laravel dusk that specific string is a part of datatables? On screen shot I see that string...
Testing
9
163
hjortur17 hjortur17
17

Session is missing expected key [errors]. Failed asserting that false is true.

Hi, I can't figure out how to get this to green. I get this error message when running this method ERROR: Session is missing expected key [errors]. Fa...
Testing
17
3898
longestdrive longestdrive
2

Laravel Cypress and Colorbox problem with authenrication

Hi Gradually getting my tests to work with cypress but having another struggle today. On a page I have a button which opens a form within a jquery colorbox. The form...
Testing
2
110
Elenktik Elenktik
1

PHPUNIT withSession fails on CI / CD pipeline?

All tests from my Laravel application are passing localy. However on my CI/CD pipleline on Gitlab one tests fails that is using withSession: $re...
Testing
1
109
mathewparet mathewparet
4

Dusk not identifying VUE components?

I have this dusk test class: public function testRegPageAsksForInvitationCodeIfInviteOnly() { $this->browse(function (Browser $browser) {...
Testing
4
170
gianmarx gianmarx
5

Fail Assert API token Laravel

I am running the following test and something is not right: public function testBasicTest() { $token = 'lFMcWnzCWxzP...nIPMF8UF...gbQKCO'; $token_fak...
Testing
5
143
Epitome Epitome
4

Laravel 8 and livewire testing, actingAs($user)

Hello all. I made a fresh installation of laravel with livewire. My basic test looks like this: $this->withoutExceptionHandling();...
Testing
4
173
jgravois jgravois
9

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...
Testing
9
822
madsem madsem
1

Test passes locally, but fails during CI (GH actions)

I'm having a curious case of a feature test here. During an import of a large csv file, a temporary mysql table is created. The csv file is loaded into the tmp tabl...
Testing
1
119
josebailon josebailon
4

Laravel 8 - Factory namespace when developing package

I'm learning how to develop packages for Laravel. When I try to use Factory on tests it fails because it tries to use a Factory with a fully qualified class name made by Da...
Testing
4
238
megaman megaman
1

Mocking a class which returns a object

I need to mock a class. The problem is that one of the methods on the class (which I need to mock) returns an object which itself contains method calls. so th...
Testing
1
107
aleks_st aleks_st
11

Tests clear the active DB

Hi, The tables in my active DB are empty after tests. I have the test environment variable DB_CONNECTION='mysql_testing'. When I run my tests and...
Testing
11
15536
simioluwatomi simioluwatomi
2

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...
apoca replied
Solved
Testing
2
655
gianmarx gianmarx
0

cypress not working

cy.visit() failed trying to load: http://l8.test/register The response we rece...
gianmarx gianmarx
1

how to select element value from table in Cypress?

I have the following table: <table id='hometable' class="table-auto "> <thead> <tr> <th class="px-4 py-...
Testing
1
132
explose explose
0

Please delete

Can we delete this ? pls...
gianmarx gianmarx
0

assert error cypress test E2E expected { Object (userInvocationStack, specWindow, ...) }

I have this table with the following structure: <tr> <th class="px-4 py-6">id</th> <th class="px-4 py-6">s...
miguellima miguellima
4

Laravel Test Pass when run single test, but fails when running all tests

Hi, everyone, So I just got stuck on testing, because when I ran my test individually it got success. When I run all tests, that test fails. When I ena...
Testing
4
155
SlimDeluxe SlimDeluxe
0

Using orchestra/testbench but errors are not logged

I have the default setup, logging to storage/logs/laravel.log. When I get an error in runtime while viewing the app in the browser, it is written to the log. But when I run...
BJBT99 BJBT99
4

Testing ability to like a post

Hey guys I am really fresh to testing and was hoping to get some insight on how to write this test out to check that an authenticated user can like a post. I already have t...
BJBT99 replied
Solved
Testing
4
170
longestdrive longestdrive
2

Cypress & Laravel - Persist user login

Further journey on cypress To avoid having to login a user each time on my tests I've been looking at ways of persisting the login session. Found this guidanc...
Testing
2
178
futurefuture futurefuture
1

schema:dump test sqlite

Love the idea of this feature in L8! However, I am using sqlite in memory for phpunit - anyone know how to implement the schema:dump just for sqlite in memory for te...
Testing
1
141
jjmu15 jjmu15
2

Opposite of assertJsonFragment

Hi, Apologies if this is a silly question but how would I test for the opposite of assertJsonFragment to be sure that a record is not returned within a resource coll...
jjmu15 replied
Solved
Testing
2
138
trevorpan trevorpan
4

add HasFactory trait to Model::class() vs. each model?

If each model extends: <?php namespace App\Models; ... class Order extends Model { Is it reasonable to just add it to the Model class?...
Testing
4
272
marcoCarcangiu marcoCarcangiu
3

Laravel Dusk not picking up APP_URL in .env.dusk.local file

Laravel dusk does not seem to use the APP_URL set in .env.dusk.local file. This is my .env.dusk.local file: APP_URL=http://local.project/ BASE_URL=h...
Testing
3
1949
jeFFF jeFFF
6

Deploy migrations for test env only

Hello there, I think the question is explicit but let be more precise. A client of mine have a DB which is created and seeded by his system, on top of that I have a...
Testing
6
2073
Create a New Discussion Button