phpunit Questions
5
Solved
I'm trying to properly mock a chained call to an Eloquent model in a controller. In my controller I'm using dependancy injection to access the model so that it should be easy to mock, however I'm n...
12
Solved
I am running tests in PhpStorm and I get this error. Does anyone know what on earth could be causing it?
PHP Fatal error: Class 'PHPUnit_TextUI_ResultPrinter' not found in
C:\Users\administrato...
3
Solved
I'm running a brand new test suite in PHPUnit, I'd like to see the result of each test with the test name next to it. It would make fixing broken tests and TDD easier.
PHPunit does output the brok...
Cumber asked 7/8, 2014 at 10:28
4
Solved
consider the following:
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;...
Chippy asked 3/1, 2016 at 21:48
1
Solved
where running all test
php artisan test
everything work as expected and all tests runs
now , when i run signle test php artisan test --filter test_get_profile i get this wired error
An error occur...
Pryer asked 3/6, 2023 at 16:20
5
I keep getting status 500 when 200 is expected. These are the files:
ExampleTest.php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class Exampl...
5
Solved
I'm using Codeception for unit, functional, and acceptance tests of my Laravel 4 PHP application.
My unit tests look this:
use Codeception\Util\Stub;
class ExampleTest extends \Codeception\TestC...
Glary asked 29/1, 2014 at 12:20
2
I'm testing a suite of REST web services with PHPUnit. We're using output buffering in order to gzip-encode the responses. When I run a test for the service with PHPUnit, I'm getting the error:
Ca...
Oops asked 4/1, 2013 at 6:59
3
Solved
I'm writing a small API in Laravel, partly for the purposes of learning this framework. I think I have spotted a gaping hole in the docs, but it may be due to my not understanding the "Laravel way"...
4
Is there any way to run a test on output created from a call to 'error_log("Message")' when doing unit tests with phpunit?
Example code, one of my functions tests a credit card with a luhn algorit...
Variant asked 14/2, 2014 at 16:16
4
Solved
I have written an abstract test case class that is to be extended by concrete test case classes.
It extends from the PHPUnit_TestCase.
Is there a method or annotation that signals Phpunit to not ...
2
Solved
Versions :
PHP : 8.1
PHPUnit : 9.5.21
Symfony 6.1
When the following test is run by PhpUnit, I get an error about the session not being able to be started. Does anyone have an idea of the problem...
3
Solved
I'm using Monolog inside Symfony2, using the default MonologBundle. I'm trying to assert inside my tests, that a line is logged. I've configured this in my config_test.yml:
monolog:
handlers:
ma...
5
Solved
In my phpunit I have this configuration:
<php>
<env name="ENVIRONMENT" value="test"/>
</php>
I worked under the false assumption that it always would set the environment varia...
Frick asked 18/2, 2016 at 10:49
3
I'm trying to use the integrated method of running phpunit tests within PHPStorm and having some issues getting it to work.
PHP: 5.6.10
PHPUnit: 4.5.1
PHPStorm: 8.0.3
Thanks to https://stackoverf...
3
Solved
I'm started to write tests in Laravel. My application works, I can login, run migrations, but when I'm trying to test the login, I'm getting the following error:
could not find driver (SQL: PRAG...
Keeper asked 5/2, 2020 at 12:49
6
For example, the action in test1 stores data externally* which test2 then performs an assertion on, but tearDown deletes that data thus breaking test2. Cache deletion can't be removed from tearDown...
3
Solved
I know stubs verify state and the mocks verify behavior.
How can I make a mock in PHPUnit to verify the behavior of the methods? PHPUnit does not have verification methods (verify()), And I do not ...
Blythebm asked 30/8, 2017 at 16:39
4
Solved
So I have PHPUnit running in PHPStorm 7.1, but I can't find out how to get the ANSI color codes working from within tests. My PHPunit.xml has colors = "true" in the property list, but every time I ...
7
I am able to run a single test from a suite using --filter option.
I am wondering if there is a way to dynamically run multiple tests under the suite?
Thanks
3
Solved
PHPUnit :: get message: OK, but incomplete or skipped tests! without any information where is happen
Get message:
OK, but incomplete or skipped tests!
without any information where is happen.
Only the: ..I........
How can i find where is the problem?
Thanks
10
I created a .env.testing file with my credentials, everything the same as .env besides a different table name for the database.
I tried php artisan config:clear which deletes the cached config fil...
6
Solved
Is there any way to define different mock-expects for different input arguments? For example, I have database layer class called DB. This class has method called Query(string $query), that method t...
6
I have a class that would want to mock later in a test:
class Original {
function calculate($a) { ... }
}
in test:
$mock = $this->getMock('Original',['calculate']);
$mock->expcets($this-...
5
Solved
I'm running into an issue when writing unit tests with PHPUnit using @dataProvider in a Laravel app. The error I'm receiving is:
PHP Fatal error: Class 'Eloquent' not found in /path/to/project/a...
Lynda asked 29/1, 2015 at 15:8
© 2022 - 2024 — McMap. All rights reserved.