Questions tagged [pestphp]
19 questions
2
votes
0 answers
How to PestPHP tests in a specific order?
Looking at the Pest documentation seems that there is no way to run test in a specific order, except renaming file with something like "01_Auth...", "02_Organization...". This doens't seem a standard or correct way to run tests that depend on…

Veenz
- 362
- 2
- 7
1
vote
0 answers
Run PHPUnit rather than Pest
I have a project with a mixture of tests wrtten in Pest and regular PHPUnit Test Classes. There is a lot missing from Pest for package developers and its just simpler to use the PHPunit for areas where Pest can't help. Pest is great and I can use it…

Zakalwe
- 1,444
- 3
- 14
- 25
1
vote
1 answer
Mocked class but the original class is still being called
I'm trying to mock a third-party class called TwoFactorAuth, so in a test, I expect true to be returned to a method call. False is returned from the real class.
$this->mock(TwoFactorAuth::class, function (MockInterface $mock) {
$mock
…

Dave
- 878
- 8
- 19
1
vote
0 answers
Laravel Pest testing not returning summary of pass/fail tests
During Pest test runs, we're unable to see a summary of passed and failed tests at the end. This issue is causing problems for our pipelines in GitLab, as they can't detect errors without exception messages being printed. Although we can manually…

RomkaLTU
- 3,683
- 8
- 40
- 63
1
vote
0 answers
Run PestPHP tests with Laravel Sail local setup
My Laravel local setup with Sail is using pgsql as database, so everything get orchestrated by sail up. Now I want to write tests by using sqlite in memory because the testing pipeline finally should not require to spin up a Postgres server nor I…

nixn
- 1,337
- 3
- 16
- 33
1
vote
0 answers
Pest PHP use Trait with abstract function
I`m new to pest PHP and trying to use a trait within an pest PHP file. Within an trait I have an abstract method where I have to enter the route name. But I dont know how to call the abstract function correctly within pest?
This is the…

Lx45
- 95
- 2
- 10
1
vote
1 answer
PhpStorm PestPHP ShouldNotHappen
For some reason I always get this error when I try to run Pest tests in PhpStorm:
/usr/local/bin/php ~/project/vendor/pestphp/pest/bin/pest --teamcity --configuration ~/project/phpunit.xml ~/project/tests/Feature/SampleTest.php
Pest 1.20.0
…

atorscho
- 2,069
- 2
- 15
- 20
0
votes
1 answer
PestPHP with Laravel Zero, Output not printed
I work on laravel forge cli, this repository github. I'm trying to add new functionality to this project, so I've created a new command below:

Stollpy
- 35
- 6
0
votes
1 answer
How to correctly make a Unit test for a method that is downloading a file from FTP Server using Laravel 10
I'm attempting to write a unit test, preferably in PEST PHP, to verify the following method:
Data is retrieved from the 'producers' table in the database and fed into the configuration. This configuration includes FTP server access details.
The file…

Greg Ostry
- 1,161
- 5
- 27
- 52
0
votes
3 answers
How to move functions from closures to normal functions
I'm trying to make a pest test file easier to read.
Currently, I've got some standard tests:
test('can get subscribers latest subscription', function () {
$this->seed(PlansTestSeeder::class);
$this->seed(SubscriptionsTestSeeder::class);
…

Blakey UK
- 53
- 8
0
votes
1 answer
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.users' doesn't exist (Connection: mysql, SQL: select count(*) as aggregate from
I am trying to test signup for user in pest here is my pest code
test('signup user', function () {
$response = $this->post('signup-user',[
'email' => 'vishal444@gmail.com',
'first_name' => 'vishal',
'last_name' =>…

Vishal Kumar
- 19
- 3
0
votes
1 answer
How to test Laravel Scout adds data to indexes and search results match properly?
I'm trying to test my Laravel Scout (Mellisearch) with PestPHP. Testing the model data gets sent to the search index and the search is correct.
For the search, if I were to search user $user = User::search('wanna_coder101')->get();, then it'd return…

wanna_coder101
- 508
- 5
- 19
0
votes
2 answers
How can I run a specific example using PEST (PHP)
Now I use ./vendor/bin/pest as explained in the docs. But that makes me run all tests. What if I only want to run one specific example? Do I need to use groups or can it be done in an easier way?

Brainmaniac
- 2,203
- 4
- 29
- 53
0
votes
0 answers
Difference assertions and expectations in PEST (PHP)
I am starting to use PEST in my Laravel-project. I started to read the documentation and saw that both assert and expect exists but I see no real explanation on their difference.
Can someone please tell me the difference and when to use what?

Brainmaniac
- 2,203
- 4
- 29
- 53
0
votes
1 answer
Login as multiple users during same test - Laravel and PestPHP
I'm trying to run a single test where multiple users are performing actions. There is either a bug in the actingAs() function, or I am completely missing something trivial. So here's the scenario. I have a social media site. I want to login as one…

eResourcesInc
- 948
- 1
- 9
- 17