phpunit Questions

4

I am developing a Laravel application. I am doing unit testing to my application. Now I am having a trouble with testing the verification process. What I am trying to do now is that I am registeri...
Slacker asked 21/12, 2018 at 12:30

2

Solved

How to assert (in PHPUnit test) that Eloquent collection contains an item? Something like this: $expected = factory::create(Item::class)->create(); $eloquentCollection = someData(); // Item::o...
Selle asked 8/12, 2016 at 12:33

3

Solved

I'm using PHPUnit to create a Unit test for a store function that stores data in a database. Currently, i have a test verifies that it has stored data. However, I also want to create a test tha...
Chondrule asked 9/7, 2018 at 13:6

5

Solved

Am using Laravel Passport to build an API, I removed the web routes and its guard accordingly How can I test user logout? This is what I have so far: Logout Test /** * Assert users can logout * ...
Apterygial asked 5/9, 2019 at 22:47

3

First of all, the title would suggest this is a duplicate of this or this, but for a couple of reasons, those answers don't work for me, even if my initial problem is the same. I'll explain why. M...
Stinson asked 28/5, 2014 at 15:10

1

I'm running PHPUnit from the command line in windows as follows: php phpunit.phar --bootstrap .\commonTests\bootstrap_local.php .\commonTests\DIContainerTest.php --testdox --stderr -v and I'm get...
Ailsa asked 9/5, 2023 at 7:49

5

Solved

I just updated my Mac M1 to Big Sur 11.5.2 and something in VSCode seems to have broken. I am unable to use the latest home-brew php which is installed. In VSCode its pointing to /usr/bin/php which...
Brussels asked 23/8, 2021 at 21:21

3

Solved

I have a fresh installation of laravel 5.4 I've tried to modify the default test just to see a failing test. tests/ExampleTest.php class ExampleTest extends TestCase { /** * A basic test examp...
Proffer asked 30/1, 2017 at 21:22

4

I have included PHPUnit in a test vanilla PHP project and when I start the test with vendor/bin/phpunit I get the following error message: Your XML configuration validates against a deprecated sche...
Lea asked 23/2, 2023 at 9:58

2

Each time I run my tests with php artisan test after when I want to see the inserted data in my database, the table is totally empty. Here is my test class ExampleTest extends TestCase { use Refr...
Belleslettres asked 12/2, 2021 at 12:12

3

I had a method, that opened a socket connection, used, and then closed it. In order to make it testable, I moved the dealing with the connection to separate methods (see the code below). Now I wan...
Nananne asked 23/12, 2016 at 11:41

10

Solved

I want to test specific testClass in my project since there are a lot of test class that's failure and I just want to test one Class at a time. I've created the test Class in following folder \test...
Genuflection asked 24/8, 2016 at 8:25

2

I have searched and read the docs, or at least I think I have, but I have been unable to find if there a way to get a list of all the skipped tests with PHPUNIT? Is this possible?
Argillaceous asked 7/4, 2016 at 2:2

3

Solved

For some reason when i sent a new $client->request the headers I specify get lost: public function testGetClientsAction() { $client = static::createClient(); $cookie = new Cookie('locale2', 'en...
Status asked 18/7, 2012 at 20:24

3

I'm getting the following errors when I try to run phpunit on my symfony project: $ phpunit -c app 1) [...]\DefaultControllerTest::testIndex Symfony\Component\Config\Exception\FileLoaderLoadExcep...
Pocky asked 10/5, 2013 at 13:0

3

Solved

I want to use PHPUnit to test my PHP class. Is it possible to put data providers for my test methods in a separate file created only for storing dataproviders? If so how to do that? Another ques...
Cordeelia asked 4/6, 2017 at 9:47

4

Solved

I'm currently using Zend Framework in conjunction with PHPUnit to conduct unit testing on an application. When Hudson executes the PHPUnit shell command, the maximum PHP memory limit is reached som...
Overcome asked 8/10, 2010 at 23:49

1

Solved

Phpunit 10 has made non-static test providers deprecated. This makes creating test doubles inside the provider problematic, because methods like createMock() or createStub() are not static. Here is...
Externalize asked 7/8, 2023 at 15:23

3

Solved

I am using laravel 5 with php unit to create a laravel package. I have a Repository.. namespace Myname\Myapp\Repositories; use Myname\Myapp\Models\PersonModel; class PersonRepository { protecte...
Ioyal asked 19/4, 2016 at 15:54

6

Solved

I currently have a problem that I have to work around in legacy code to get our interaction with a PHP Extension to work properly (Singleton Testing Question). As such, I do not want to execute th...
Hemispheroid asked 20/4, 2012 at 20:39

4

Solved

I'm getting to grips with PHPUnit, and have so far found it pretty easy to use, but I've run up against a test case that's causing me difficulty. I'm writing code against a set of interfaces that...
Rao asked 17/12, 2011 at 10:44

4

I'm looking for a way how to run a testcase multiple times with different setting. I'm testing a database access class (dozens of test methods), and want to test it in "normal mode" and then in "...
Aoristic asked 15/8, 2013 at 13:15

4

Solved

The output you get from phpunit when you specify --testdox is prettier and more informative than the default dots, so I would like to see it that way all the time. But I've not been able to figure ...
Hassett asked 11/3, 2019 at 16:49

7

I know about the "--repeat" option, but I'd rather define the repeating within the test and per test. In my unit tests there are tests I don't want to repeat, and there are tests I want to repeat m...
Bibliofilm asked 28/2, 2012 at 20:20

9

Solved

Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to separate the life cycle of an object from creation to use to destruction but I need to make su...
Sherborn asked 13/8, 2008 at 19:2

© 2022 - 2024 — McMap. All rights reserved.