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-...
Testing
2
589
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...
Testing
4
1070
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...
Testing
1
578
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
1130
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...
Testing
3
1136
ohffs ohffs
1

Speeding up tests via Hash::setRounds()

I couldn't see this being posted already, but Taylor put out this tweet :...
Testing
1
1086
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...
Testing
2
1122
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 @@ @@ -'...
Testing
4
1116
sndytj sndytj
2

Strange execution of PHPUnit

When I run the PHPUnit tests it shows the prefix 'Issuer' which is the app / Http / Controllers / Issuer / IssuerReceiverController.php directory One of the tests I...
Testing
2
1152
nicolasbuch nicolasbuch
5

How do I create a route while testing?

Hi there, I'd like to create a route in testing, I tried to inject the route to the service container but it didn't work for me, any idea:...
Testing
5
1181
canadianlover canadianlover
3

Forum episode 4 - reply not showing up on threads page

I am following this tutorial: https://laracasts....
Testing
3
956
PaulB PaulB
6

API Testing Problem: The POST method is not supported + Invalid JSON was returned from the route.

Hello everyone, I am testing API with Passport Auth and stuck with the issue. For some reason almost every Unit Test has an error simlar to this: 1) T...
Testing
6
1197
trifid trifid
0

Vue testing

I'm testing Vue components using v-i18n for localizing and private Channels and I get these errors: TypeError: _vm.$t is not a function TypeError: Echo.privat...
jmariller jmariller
7

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
7
1256
jorgenb jorgenb
2

Dusk environment handling

I have tried adding .env.dusk.local file as detailed here on my 5.8 (upgraded from 5.7 som...
Testing
2
1134
basemrayleigh basemrayleigh
3

Testing withHeader throws badmethodcallException

After going through the documentation I saw that withHeader would give test for the output that I want. The test simply sees if you're logged in, and displays some function...
Testing
3
1153
basemrayleigh basemrayleigh
2

Testing logout through Factory

Hi am new to testing with laravel and I wanted to test the logout functionality I have. after searching I reached this function but it's giving me a redirect response ( whi...
Testing
2
1162
GlenUK GlenUK
1

Get more infomation on test failure

Hello, I would like to know why this test failed: /** @test */ public function purchaseOrderAddedViaStoreMethod() { $this->withoutExceptionHand...
Testing
1
1121
marcoCarcangiu marcoCarcangiu
2

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
2
1183
duellsy duellsy
0

How can I test a multi-tenant Postgres app with in memory sqlite?

With our app, we're using Postgres as our DB. We have a public schema that houses all shared data, then each customer has their own schema (company_[ID]...

How to test Personal Access Token with Passport?

So I have this in my controller: public function sendSimple( SimpleNotificationRequest $request ) { auth() ->user() ->notificat...
mohammadkaab mohammadkaab
1

Should we use those migrations which they are only for changing the data

Hey guys, We have a bunch of migrations (200+) which most of them are there to change the data in the database and that affect our testing. For example we have a mig...
Testing
1
1128
canadianlover canadianlover
5

Forum video series - PHPUnit throws unauthenticated error

So I was following Jeffery's forum video series when I got to lesson 10. I initially ignored lesson 8 where I was supposed to update my TestCase.php file for exception hand...
Testing
5
1162
mstdmstd mstdmstd
18

Error testing with user creation and triggering button click

Hello, In laravel 5.8 app I make Feature/test with user creation and opening profile page of the created user and I got error when triggering button click: &...
Testing
18
818
crnkovic crnkovic
3

Rollback database after each test method

Hey, I've got bunch of tests that used to run on Sqlite in memory database and it all works fine. Now that I need to run it against an actual MySQL database, errors...
Testing
3
1183
far1han far1han
5

The bootstrap/cache directory must be present and writable

getting error while test locally @Sti3bas can you please look in to this...
Testing
5
1185
lambooni lambooni
6

PHPUnit Assert Code Completion

I am using Laravel valet and have setup my PHP Storm as follows: Kept the default phpunit.xml file apart from updating the db_connection to sqlite and db_d...
Testing
6
1242
PetroGromovo PetroGromovo
5

How in testing switch DatabaseTransactions off/on on condition?

Hello, In laravel 5.8 application I use test with DatabaseTransactions option, so inserted data in testing db are cleared after testing, like: <?php name...
Testing
5
987
jeFFF jeFFF
5

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
5
1220
Lestah Lestah
5

Array to string conversion Feature Test

/** * Add. test pass * * @test * @group feature * @group feature:setting * @group settings.index * @return void */ p...
Testing
5
1215
AhmadXII AhmadXII
8

Testing Laravel user registration

I have added some functionalities to registered method of laravel auth system in RegisterController such as dispatching events and making new fields in other tables. Now, i...
Testing
8
1227
mcbates mcbates
1

Customize test stub with test annotation instead of having to prefix test_?

Is there an easy way to swap the comments in test stubs that artisan creates (php artisan make:test ExampleTest)? So, whenever I create a test, instead...
Testing
1
1156
mazedlx mazedlx
10

Mocking additional external database calls

My application consists of two databases, one in MySQL which I can tests with DatabaseMigrations and one in Oracle which I can not run tests on. So, I n...
Testing
10
1234
buiduchanh99tb buiduchanh99tb
0

Output specifications production information Barriers FJC-D68B

production Category´╝Ükinky weapon system product details Barriers FJC-D68B Fujica wavy boom barrier departure gate,self intention and manufacture, highly unsegregat...
Create a New Discussion Button