FutureFreak FutureFreak
1

Stress/load testing unit tests?

I have some tests for a booking system project - which tests that a customer can book a space on a particular event. This works well when run sequentially. However,...
marcel158 marcel158
2

Use .env.testing for phpunit

When I run unit tests I do operations on the database, combinated with the RefreshDatabase trait. However to not mess up with my application database, I created a file .env...
danilchican danilchican
3

Which tools are exist to do performance/load testing?

Hi all! Since my project is going to live and will have over 50,000 users soon, I want to prevent performance issues and do testing before. Does anybody know...
learner1982 learner1982
1

Detect that laravel is running test in controllers?

Hi, when laravel run tests, both unit test and feature tests, does is sets any global variables, that I can detect other places in the application? I'm not intereste...
hjortur17 hjortur17
14

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
14
548
Corbin Corbin
3

Do you guys test auth?

When working on authentication and adding various fields like username and slug to your users table do you guys test it? Why or why not? I'm trying to get better at develop...
jgravois jgravois
1

Lost Trying to Mock a Guzzle Presenter in phpUnit

I am trying to test this method public function searchForInvoice($inv) { $qp = new QuantumPresenter(); $type = request('searchType');...
canadianlover canadianlover
20

Forum episode 25 - Class name must be a valid object or a string

I am following the Forum series. I recently changed my web.php file to point all of the forum specific routes to a domain name. Now when I run phpunit...
Testing
20
201
bwrigley bwrigley
8

Mocking Cashier methods

Hello, I'm sure I'm missing something obvious here. I'm using Cashier and Stripe for billing and I have a simple method for showing invoices retrieved from Stripe....
Testing
8
133
bhushan bhushan
3

AssertSee multiple thing in phpunit test

/** @test */ public function it_shows_top_ten_profiles_according_to_the_reputation_points_earned() { $users = create('App\User'...
Testing
3
122
Manium Manium
3

Vue + Jest + Typescript Unexpected reserved word 'let' and Jest encountered an unexpected token

I get different errors by unit test for working code. With babel installed "Unexpected reserved word 'let'" and without babel installed "Jest encountered an...
Testing
3
168
budiantoip budiantoip
5

How to mock model's static function in phpunit?

I'm using laravel 4.2 and phpunit 5.7. [email protected] : public function index() { $my_profile = View::shared('my_profile'); $per_page...
Testing
5
119
TxNuno TxNuno
2

Cannot mock class

I am attempting to test a controller method that sends an external api call. The store method calls news up a Crawler instance like so. public function store...
jesse_orange_newable jesse_orange_newable
1

Testing within model observers

In my recent projects I've been experimenting with Observers and they seem like a great way to do things tied to model events. In one model called...
Steady-Entertainment Steady-Entertainment
4

receving 201 instead of 200

Hello community, In the following episode...
stevepop stevepop
9

DATE_FORMAT() FAILING IN SQLITE

I have a method calculating the number of user signups; public function getSignupsCount() { $users = DB::select('select count(id) as count, DAT...
Testing
9
539
jmariller jmariller
8

Issue with Vue Test Utils in Laravel

Hi all, i am trying to use the Vue Test Utils libraries for testing some Vue.JS components but I am facing issues when running the tests - following error message is...
Testing
8
1483
JChimene JChimene
4

phpunit $this->post() returning unlogged error 500

Hello Humans, This function /* * Verb URI Action Policy Method Route Name * POST /clinics store create clin...
bwrigley bwrigley
1

'Risky' test

I have a feature test which is giving me this error: Test code or tested code did not (only) close its own output buffers I understand this can b...
Testing
1
100
trevorpan trevorpan
7

help with $this->actingAs($user)->post(...);

Alright, very close, but I find if I create a factory (with faker data) that handles all the fields the array second argument gets upset. A number of my other tests pass wi...
Testing
7
119
troccoli troccoli
0

How do I use Dusk's method waitUntilVue() ?

As part of a project I am working on I build a Vue page to display some sport fixtures. The page is quite simple: there are three dropdown, one for the season, one for the...
Markk Markk
3

Does someone know what is this referencing?

Sometimes the test passes, like 1 out of 10 times, with others i get this error. Test was green but after following Jeff adding some styles to pages this happend. Thanks f...
Testing
3
134
xtremer360 xtremer360
5

Looking For a Better Assertion

What I'm debating is assertions in the last two test methods. Currently, I have it trying to retrieve the currentEmployment but I don't have anything that specifically says...
Testing
5
147
Steady-Entertainment Steady-Entertainment
8

Confusion / Explanation / Tutorial for JSON in testing with PHP unit

Hey guys I am a bit confused and cannot really understand the overall concept of the following commands. When do I use which one and what does it actually do?...
Testing
8
124
tobyreed tobyreed
4

Laravel Dusk/ChromeDriver - Class Env does not exist

Hello, So after a long time I have decided to pickup Dusk again to test the front end. Tried to run dusk and I get the following issues: Facebook\WebDri...
Steady-Entertainment Steady-Entertainment
3

Framework error after refactor

Hello guys, I am at https://larac...
b1narylife b1narylife
8

"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
8
868
mstnorris mstnorris
32

Very slow PHPUnit tests using PHP7.2 or PHP7.1.

If I run my tests using PHP7.2 or PHP7.1 they are about 3x slower than if I run them using PHP7.0. Is there anyway to get to the bottom of why this is happening? I'm...
Testing
32
1424
mauricebalde mauricebalde
17

Laravel 6 Testing phpunit wont work anymore

Just made a new fresh Laravel 6 project and added 1 test. When I run phpunit even when the test is empty totally: /** @test */ public function a_user_can_see...
Testing
17
231
MarkOmeje MarkOmeje
8

PHPUnit With Middleware

Even after logging in, i still get thesame error. Session is missing expected key [errors]. Failed asserting that false is true. C:\xamp...
Testing
8
154
squibby squibby
7

Is there any way to show browser window when running dusk tests from within homestead?

I have multiple Dusk tests which I run inside homestead. I need to run inside homestead because I tear down and reseed the DB after for each test. My current tests work fin...
Testing
7
180
chris.schmitz chris.schmitz
8

When I try to setup phpspec for PSR-4, the files it creates are not placed in the correct namespace folder

I want to use phpspec with my psr-4 formatted projects. Here's the way I tried to set up a test project: Created a new folder for the project:...
Testing
8
255
Squire Squire
16

Rewrite in Laravel how to work with current database

So I am rewriting some legacy code into Laravel but my doubts are in how to work with my current database? specifically with the database tests. I did not created it with m...
Testing
16
167
davewood davewood
4

laravel test "remembers" api_token authentication for unauthenticated followup request

I see this behaviour only with the laravel test system, cannot reproduce when i make the same sequence of requests with curl or browser. get('/api/foo?api_toke...
Testing
4
138
dbudwin dbudwin
1

Test middleware that relies on sessions

I want to write a unit test to make sure my middleware redirects users as expected. My middleware checks to see if a user is logged in by verifying a token is set in the s...
Testing
1
122
Create a New Discussion Button