drewdan drewdan
2

Disable CSRF in Tests

I am having a problem with my code where I am running a test as follows: $this->withoutExceptionHandling(); $this->withoutMiddleware(VerifyCsr...
drewdan drewdan
4

Faking a File Upload

Hi All, Im having a few issues with faking an image upload. In my controller I have the following if (isset($data['emailCustomisation'])) { $em...
jeffz2016 jeffz2016
4

assertSee, assertSeeIn case sensitive?

As in subject. I use css uppercase and test comes negative. Bit strange, should be in docs....
Testing
4
210
jeFFF jeFFF
3

Phpunit fails

Hello, I look for an answer for maybe a minor problem. My test suits suddenly fails with this error message : Mockery\Exception\BadMethodCallException: Receive...
trevorpan trevorpan
9

Should /tests be in .gitignore?

It seems like this folder should not make it to production. However, having versions of tests also seems like a logical and good thing. There's no mention of .gitign...
Testing
9
101
Tenatious Tenatious
5

PHP Unit Not Catching Wrong Class Name On Dev?

Hi, So I have a unit test running that is checking for a page redirect and that the page is displaying some text. The test passes on my localhost as I'd expect and I...
hjortur17 hjortur17
3

Error while testing

I just created a new Laravel project and I get this when running my tests. Mockery\Exception\BadMethodCallException: Received Mockery_1_Illuminate_Console_Ou...
Thyrosis Thyrosis
11

Custom service provider gives Purify errors in PHPUnit test

Hi guys, This is a weird one. I'm trying to add some extra allowable HTML elements to Steve Baumans' Purify. It takes a custom ServiceProvider, seeing as the...
Testing
11
230
yoeriboven yoeriboven
1

ExpectException() doesn't work when it is catched

Here's my (simplified) code: /** @test */ public function it_throws_an_exception() { $this->withoutExceptionHandling(); $this->expectExcep...
nuwave nuwave
3

5.1 Factory twice as slow as TestDummy

I've upgraded my application from 5.0 => 5.1 and started swapping out TestDummy for the built in factory "Illuminate\Database\Eloquent\Factory". When I ran my...
Testing
3
148
jeffpuckett jeffpuckett
1

phpunit.xml for dusk

Because the dusk tests take so long, I'd like to kill it on failure instead of waiting for all the rest to run - especially because I have some scenario-based tests that wi...
cosminc cosminc
2

Unit testing the logic behind an Artisan command

Hi everybody, How can unit test the logic behind an Artisan command? I have a command that as an input receives the name of the file and then it imports that...
RobertOs RobertOs
0

Laravel and test with JEST

Hi. I have a little problem with jest and laravel. Maybe you will be able guide me somehow. I want use jest test in laravel. I found guide how to do it:...
r_duong89 r_duong89
14

Redirect not working

I'm trying to redirect to a /thread/id from the Build A Forum Lessons on Episode 8 using a path() function that is supposed to 'return '/threads/' . $this->id' but it re...
Testing
14
113
akogler akogler
3

Dusk does not execute button click & contenteditable field updates sporadically

Hi to all, I have two issues with my dusk test case that drive me nuts as I can't figure out what I am doing wrong. My test case is: /** @test */ publ...
ixudra ixudra
0

Mockery: cannot redeclare method

Updated my composer file and suddenly all my tests fail: - AccountControllerTest: Index PHP Fatal error: Cannot redeclare Mockery_0_Illuminate_Auth_Access_G...
itstrueimryan itstrueimryan
0

Dusk Testing: Vue + Passport

I've successfully set up a login test in Dusk that hits my Vue/Laravel application, enters some credentials in the login form, hits submit, and goes to the home page. But...
jbreuer95 jbreuer95
4

More useful form validation feature tests

I built a big CMS system so it was time I started learning how to test, whoops. I watched a bunch of videos but testing form validation rules seemed like a lot of work that...
Testing
4
110
hfalucas hfalucas
6

Overriding values in model factories

Quick question, Having these model factory: $factory->define(Api\Country::class, function(Faker\Generator $faker) { return [ 'code' =&g...
Testing
6
562
valentinog valentinog
1

Testing a Laravel application with Cypress: 419 insufficient space on resource

I'm testing a Laravel application with Cypress. The test for the login page looks like this: describe("Knowledge Base...
Testing
1
195
ryanmortier ryanmortier
1

How do you know what to test?

I'm starting to work through the "Let's Build A Forum with Laravel and TDD" series but one thing I'm wondering (not sure if it's answered later on in the series)...
randel33 randel33
1

How to check if dusk is running

I've tried App::environment to see if .env.dusk.local is returned, but .env is returned. I do know for a fact the .env.dusk.loc...
lorvent lorvent
2

what testing tools/packages do you use?

Hello All, Lately i am thinking more and more of learning and using tests in projects to avoid bugs. i am using phpunit, dusk tests now but thinking of...
Testing
2
157
webcodecs webcodecs
5

Using factory in PHPUnit provider fails

Hey guys, i try to use a factory to makeusers in a provider. If i use the factory in the test directly, there was no problem. If i try to use it in a testing p...
Testing
5
407

PHPUnit throws error but works when specifying the specific test

I recently upgraded our codebase to use Laravel 5.6 and I'm finding a weird issue where phpunit will fail with the following error message: PHP Fatal err...
zachleigh zachleigh
10

Unable to locate factory with name [default]??

Trying to get Auth up and running on a project and Im running into trouble making model factories for testing. Im getting the following error when trying to create a model...
Testing
10
2753
Johnlarry Johnlarry
1

Thoughts on subscribing to Laracasts?

I've really been looking into subscribing to Laracasts. Assuming that I subscribe and absorb almost all of the information from the myriad of videos on the website, how wel...

Got error in getting the value

``` use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\D...
Testing
2
130
bjornlindholm bjornlindholm
2

AssertSee fails even though the text is on the page

Hi, I'm working on a project and I'm currently making a filtering option. In this case what I'm filtering is jobs. I have a test for browsing all jobs and it works....
Testing
2
227
naing naing
5

Dusk selector not working

I am trying to assert the text in a button with Dusk selector as mentioned in...
Testing
5
333
yoeriboven yoeriboven
11

Comparing Factory to Eloquent model

My app uses a Settings model and every User has a hasOne relationship with a Settings model. In my tests I create a Settings i...
Testing
11
152
lizzietliu lizzietliu
3

seeding works in command line but not in phpunit test file

I run database seeding using php artisan db:seed everything works fine; but if I put $this->seed('DatabaseSeeder'); in the TestCase.php...
Testing
3
102
splendidkeen splendidkeen
6

Input field + label change logic not triggered

I am currently trying to replace a Choose a file... span with the filename of the chosen file. It worked before with the following logic. After some js changes...
Testing
6
107
ldiebold ldiebold
1

Response relations not loading when testing Laravel API

I have a simple API that returns a user with their farms. public function index(Request $request) { return User::where('admin', '!='...
Testing
1
101
tylerssn tylerssn
2

How to Mock hasMany() resonse

I have test that attempts to mock a call to a hasMany() relationship (versions() below). The problem is that first() on the relations...
Testing
2
115
Create a New Discussion Button