Jorge_19 Jorge_19
0

Error CURL in DUSK

help! I have this problem with laravel dusk, at the beginning of my project I did not use PUSHER and LARAVEL-ECHO and the tests worked correctly, but at the time of integra...
trevorpan trevorpan
3

assertContains() url: testing best practice

Hi, Have a test for emails that works. However, before I added the string url I was getting this error: Failed asserting that 'TESTCODE1234' contains "...
untymage untymage
1

Example for "assertJsonMissing" ?

Please give me example for assertJsonMissing method , What kind data should we pass on this method ? for example i want to make sure this json has not value...
Pixelairport Pixelairport
1

Testing json status (with GuzzleHttp)

I want to start with testing and wrote my first test. But the test always says that everything is ok. When using the code in a normal route and output the status i got 200....
untymage untymage
7

Testing morphOne return null in "assertInstanceOf"

I have setup migration for morphOne relationship but assertInstanceOf return null in unit test $this->assertInstanceOf(I...

Testing process in Laravel application development

I'm following TDD technique in my new project. Thus I have a set of tests which cover my controllers, model classes, services, etc. Most of these tests are HTTP test, so I...
VoidMrVoid VoidMrVoid
6

Mocked dependency is not resolved by the controller

I need to mock the dependency injection of the single-action controller. What I've done is created a mock and loaded it into the container. The issue is when I visit a rout...
bwrigley bwrigley
8

Correct way to assert that mock expectations have passed.

When writing tests and using Mockery to spy on classes, is there a correct way to assert that an expectation has passed? I have this solution at the mom...
Testing
8
128
jonassiewertsen jonassiewertsen
3

Validate datetime

I want to validate a given input. I am storing the datetime in the standard datetime format. I am getting an Exception instead of a session error. Does somebody has...
Testing
3
120
kazi-shahin kazi-shahin
26

Artisan serve can not open Localhost

Hello, I'm new in Laravel. Running Ubuntu as my OS and LAMP is install in my laptop. After create a new laravel project. Once I command php artisan serve, Browser c...
Testing
26
714
mechelon mechelon
0

Test passes auth middleware but fails Auth::user() with data providers

I am testing my application (5.8) with the integrated PHPUnit configuration and I have problems with the authentication of a user inside a test. I have this test (sh...
BobBb BobBb
2

PHPUnit lists tests vertically

How can I configure PHPUnit to revert back to making tests horizontal? It seems to have each individual test on a per line basis, whereas before the tests were just on one...
micke90 micke90
5

PHPUnit and Model Boot

Hi, So I'm building my first Laravel application right now and got stuck at testing a specific model. I have a model called "Trips" where on created...
spacedog4 spacedog4
2

Factory with relationships

I saw one time @JeffreyWay writing a test like this factory(DummyModel::class)->withDummyRelationShip(); How d...

Event fake with data inspection and once

It is possible to assert an event is only dispatched once by using: Event::assertDispatched(SomeEvent::class, 1); It is also possible to ass...
gocanto gocanto
8

Test coverage

Hi Guys, I have a question regarding the phpunit tests coverage tool. Say, I have this code: function foo(): void {...
Testing
8
159
jasonfrye jasonfrye
5

Testing hundreds of sites

At my new job, I'm being asking to write tests for over 500 microsites. The sites are a mix of technology, some are cold fusion while others are static HTML. Most have a lo...
Testing
5
244
ShaneTurner ShaneTurner
16

phpunit.xml not being read, using variables from .env

I can't get tests to run from a testing environment, they always seem to run using the 'local' variables set in the .env file rather than the settings in phpunit.xml...
Testing
16
606
untymage untymage
1

Prevent running setUp method on some tests in PHPunit

Is it possible to stop running setUp on some specific tests in PHPUnit ?...
JohnRivs JohnRivs
2

Cashier's service provider not registered during testing.

I'm trying to test a scenario where IncompletePayment is thrown and the user is redirected to the cashier.payment route. When I php artisan...
bwrigley bwrigley
8

Mock partial BadMethodCallException

Hello, I'm sure I'm missing something obvious here but I'm a bit confused about how mocking works. My Architecture is such that I have an Interface class...
Testing
8
141
valkirilov valkirilov
2

How to init the sessions provider when testing middleware?

Hi, I have a Locale middleware which is responsible for setting up the locale of my app. My current approach is to obtain the current locale from the session. Here i...

PhpUnit test date which is casted as carbon instance and saved as a date

Hi, I'm currently trying to make a test which asserts that a record has been stored in the database. The Environment model has an attribute 'ed_split' which i...
shez1983 shez1983
4

Stripe Testing (Subscriptions etc)

is there a guide on how to write tests for stripe (mocking it etc).. i have been googling but still a bit unsure? I am using latest Laravel 6.0. creating a subscript...
sanjay23 sanjay23
1

Spatie Permission + Laravel 5.8 = Multiple role feature testing failed

Hello Team, I am using the Spatie permission latest version with Laravel 5.8, However, in the feature unit testing, I am facing one role issue. Tests\Feature\...
mikail10000000 mikail10000000
3

Validation auth and functional test in one method?

Hi, I'm trying to figure out the right way of testing, currently when I test things I do it in the following test, I would write a method testPostCanBeCreated()...

How to assert a model is received by a mock

Obviously the code below is not working, I am just using it as an example how I wish it could have worked: $user = factory(User::class)->create(); $this-...
kolmogorov kolmogorov
4

Faker - providers added at each factory call

Say I have a simple factory for a Person model, for example: $factory->define(\App\Models\People::class, function (Faker\Generator $faker) { $faker-&g...
gn0rt0n gn0rt0n
0

Need help with Feature TDD and Socialite/Passport API Authentication

I am trying to do some TDD with API Authentication using Socialite & Passport. I realize that these are formal 3rd party packages that are fully tested already. I under...
davidifranco davidifranco
1

Asserting DatabaseHas and DatabaseMissing with Accessors

Whats the best way to go about Database testing when model has accessors. When you create a model the accessor are part of the returned object. Then when asserting the data...
jannevuori jannevuori
6

SQLSTATE[HY000]: General error: 1 no such table

I've been trying to get the tests working on sqlite in memory database but I have been hitting the error 'SQLSTATE[HY000]: General error: 1 no such table' I have cle...
Testing
6
117
basemrayleigh basemrayleigh
3

Phpunit Testing giving 500 when 200 is expected

I ran a phpunit test to test if my order is being deleted, it's working just fine in postman with the same order id given but it gives 500 with the phpunit test. Any idea i...
ohffs ohffs
1

Speeding up tests via Hash::setRounds()

I couldn't see this being posted already, but Taylor put out this tweet :...
mayen222 mayen222
2

Test throws BadMethodCallException : Method Illuminate\Database\Eloquent\Collection::

Hi, I'm doing a test that adds a profile to a user. When I run it with Tinker works fine, it saves the profile and can return it. But when I do it on the test (I'm trying t...
lorvent lorvent
4

Simple Authntication

I am Executing The unit test case for login page. I am getting The following Error. Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'...
Create a New Discussion Button