asmerkin asmerkin
2

Where to start when doing TDD approach

Hello, I'm starting with TDD and I've seen a few series about this, but I still have a question, that I could partially figure out, but I wanted to clear all doubts:...

Does anyone know how to unittest beyondcode/laravel-websockets in a app?

I started to use https://github.com/beyondcode/laravel-websockets w...
sasafister sasafister
3

Testing with Sqlite JSON column?

As you may know, Sqlite has different approach to creating JSON fields, so I'm wondering how do you run phpunit with sqlite if you have some JSON columns? Mysql as t...
SanthoshJ SanthoshJ
5

Request header not setting in tests

Hi all, I have a test which is trying to login and get details. I need to pass a bearer token in request header for this operation. Please see the below code. I coul...
PetroGromovo PetroGromovo
1

What can be used for vue/cli frontend / Laravel 6 Backend REST API testing

I have expierence of using laravel dusk for testing laravel 5 app with using of vuejs 2 components Now I make @vue/cli 4.0.5 / vuex 3 app with data read...
greenleaf greenleaf
2

PHPUnit automatically catching exception

I have an exception that I'm trying to test. When I use Postman, the exception is working correctly. However, when I hit the same code in my test the exception gets caugh...
Testing
2
173
greatwitenorth greatwitenorth
1

Has any got Dusk to work with Bitbucket Pipelines?

I've been trying to get Laravel Dusk working correctly with Bitbucket pipelines. Here's what my current configuration files looks like: image: mightycode/doc...
Testing
1
202
Pepijnhockers Pepijnhockers
2

Factory with relation created once!

I would like to test my service. However, I need to create a User instance [Model] and the Address instance [Model] which is a morphOne relation of User. I want to create a...
TimSch TimSch
1

Trying to get property 'email' of non-object (only in Gitlab CI)

I recently started to use Gitlab CI a while most of it works like a charm, I'm facing a pretty strange issue. All my tests succeed locally, but running them in CI some of t...
ajsmith_codes ajsmith_codes
7

Laravel 6 - TDD App - Expected status code 403 but received 200.

I am working through Build A Laravel App with TDD and I've been stuck on this particular test. In the file ManageProjectsTest, there is a test called Authenticated u...
KeironLowe92 KeironLowe92
0

Better way to write this test for a Store controller method?

So I've got a system with 4 roles, Super Admin, Admin, Editor, Viewer. I'm trying to write a test for the store method of a controller that ensures that users can't create...
clemblanco clemblanco
9

Testing Model Observer Events - Laravel 5.6

I'm facing a weird issue today while trying to test a Model Observer Event. App\Providers\AppServiceProvider public...
Testing
9
1728
philknowles philknowles
2

PHPUnit: Authentication

Is it possible to run Feature tests that require an authenticated user? I am trying to run simple route tests using PHPUnit, but because the urls can only be accesse...
upperhouse upperhouse
4

Global elements when testing endpoint

Noob test question: How does one perform AssertStatus or any other test that looks at an endpoint, when the view in question also is displaying global elements that are dyn...
xtremer360 xtremer360
8

Mocking a Trait

The test method below is not correct and would like some assistance understanding how to work with dummy classes as I've created at the bottom of the test file. My goal is...
Testing
8
187
ehsanm ehsanm
5

Laravel redirects to '/' before redirecting to $redirectTo route after login

I ran a test recently and I realized that Laravel is doing two redirections after a successful login. I set $redirectTo variable to '/dashboard' i...
babitaverma babitaverma
2

Call to a member function verbose() on integer

protected function verbose($ln = "") { $this->workflow->verbose("(" . $this->db_stap->getName() . "): " . $ln); }//verbose...
socieboy socieboy
1

@can condition on blade is not working on test unit

Does anyone know if there is something special on the @can condition when running the test case? I have a test that assertSeeText('') inside of t...
KevDev KevDev
2

InvalidArgumentException: Unable to locate factory with name [default] [Route].

Out of nowhere I got this error on my testing.. InvalidArgumentException: Unable to locate factory with name [default] [Route]. hmm? has anyone experience thi...
notsosuper notsosuper
1

A facade root has not been set and Call to undefined method Illuminate\Container\Container::basePath()

When running a PHPUnit test I am getting two errors. I can use both in my application and not get any error but when running base_path() and Http::fake()...
shan2590 shan2590
3

How to use Tinker for testing purpose

Normally tinker use for populate data! Is there a way to using tinker to execute DB level unit testing? example ?...
Testing
3
155
stebrl stebrl
6

The database session driver is weird, or am I?

Hey, I´m currently working on a feature where users can view all their sessions across multiple devices. To feature test this functionality I´m doing the following:...
Testing
6
102
vernancheta25 vernancheta25
1

validation error doesn't get triggered for array fields

Hello! I can't seem to use assertSessionHasErrors for array fields. Here's my form validation rule: public function rules() { retur...
suomato suomato
4

Testing Custom Artisan Command

Hello, I am working on a new Artisan command which help me(or you) to generate a new Vue component with boilerplate. Now the command works well and I would like to m...
Testing
4
264
longestdrive longestdrive
0

Testing with UploadedFile and Intervention/Image unable to mock

Hi I'm trying to create a test of a method that uses intervention/image to resize an image. In my test I am using: use Illuminate\Http\Uploaded...
Perdanjam Perdanjam
4

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
4
439
hasandev hasandev
3

How to test specific test in Laravel.

I want to test something specifically in Laravel. Let's say, testUserTest(). I want to test only this. How can I do that instead to running test on everything?...
Testing
3
492
bwrigley bwrigley
9

Cascading afterCreatingState() in factories

I'm creating a forum which has these relationships: ForumCategory hasmany ForumThread hasmany ForumReply and both...
Testing
9
188
Ranx99 Ranx99
1

Is this considered as a unit test?

I am trying to understand the different between a unit test and a feature test: lets say I am trying to test the password reset notification: PasswordResetNotificati...
SteveAzz SteveAzz
9

When to use PHPSpec, Behat and PHPUnit

So I went trough the Testing Collection and the new series that Jeffery have done on his awesome package. I am understanding what he is doing and why is he doing it,...
Testing
9
984
mabdullahsari mabdullahsari
16

Config reads old env values between fresh app instances

I'll try explaining my issue by giving an example from the get-go. I have an Http client that abstracts away some logic for an external service. It is bound to the I...
Testing
16
231
KevDev KevDev
2

Inconsistent Data being associate on belongsTo

Hi, I am creating a feature test on one to many relation. I just have a simple one to many relation with a proper setup base on the documentation. my test goes like this...
fylzero fylzero
7

Downsides of testing with SQLite?

I'm working on a large scale project with multiple devs and we were discussing the pros and cons of using SQLite :memory: tests. We already know t...
Testing
7
169
kkatwork kkatwork
1

TDD vs. BDD

Since I am a member of Laracasts, I have been following Jeffrey's style of TDD. I have watched more than half of the 'forum' series and I really like TDD now. I am using th...
Oldenborg Oldenborg
10

Testing if email was sent with out sending it

Im writing an acceptance test to check if the built in "reset password" functionality is working properly. How do I test if the mail is being triggered and sent w...
Testing
10
4308
Create a New Discussion Button