phpunit Questions
2
In my test, I use assertSee().
$message = '<h1>Header</h1>';
$response = $this->get($url);
$response->assertStatus(200);
$response->assertSee($message);
The problem is tha...
6
Every time I run a test all my database tables (except for the migrations table) are being deleted and I have to run the migrations again. For instance, if I have the following tables:
migrations
...
6
Im using Phpunit. If I just run my tests with:
phpunit --log-junit output.xml
this runs within a second. But if I want a code coverage:
phpunit --coverage-html ./report --log-junit output.x...
7
Whenever I execute vendor/bin/phpunit in root path of my laravel project, it gives back a Permission denied error. How can I fix this problem?
Important: I don't want to use composer update or del...
6
Solved
I am trying to recreate the database before each test in some PHPUnit test cases. I am using Laravel 5.3. Here is TestCase:
class CourseTypesTest extends TestCase
{
public function setUp()
{
pa...
Wald asked 22/1, 2017 at 12:14
4
I have recently configured VS code to debug PHP with xdebug. It works reliably with my application code but when I am running unit tests with PHPunit, my breakpoints are ignored.
My server is run ...
Tomtit asked 24/8, 2019 at 9:39
5
I am trying to run the tests in PHPUnit and getting this error.
Fatal error: Uncaught exception 'ErrorException' with message 'Class
__PHP_Incomplete_Class has no unserializer' in /opt/lampp/lib/p...
4
Solved
I want to call my mocked method twice with different expected arguments. This doesn't work because expects($this->once()) will fail on the second call.
$mock->expects($this->once())
->...
4
Solved
I'm trying to set up PHPUnit in PhpStorm 2017.1 on Windows 10 using a Vagrant box for a Laravel project. I've set up a remote interpreter, and I've been using it for a couple of months now, everyth...
13
Solved
I have run my laravel app with phpunit.
Everything is fine until at some point when I run my test again turns out with this error.
Illuminate\Database\QueryException: could not find driver (SQL: PR...
3
I've spent some time to figure out how to configure Netbeans 7.1 to work with Symfony 2 and PHPUnit, but I didn't succeed. When I try to run any test under console, there is no problem. But when ru...
13
Solved
As method withConsecutive will be deleted in PHPUnit 10 (in 9.6 it's deprecated) I need to replace all of occurrences of this method to new code.
Try to find some solutions and didn't find any of r...
Florescence asked 8/2, 2023 at 16:44
5
Solved
I'm trying to generate coverage html file with PHPUnit. I get a warning: 'No filter is configured, code coverage will not be processed' and coverage file isn't generated.
This is phpunit.xml file
&...
Cordeliacordelie asked 17/9, 2020 at 14:54
6
firstly I was receiving a warning and a fatal error. The warning:
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
The...
15
Solved
... not knowing if 'mock' is the right word.
Anyway, I have an inherited code-base that I'm trying to write some tests for that are time-based. Trying not to be too vague, the code is related to l...
6
Solved
I'm trying to create unit tests to test some specific classes. I use app()->make() to instantiate the classes to test. So actually, no HTTP requests are needed.
However, some of the tested funct...
Proposition asked 4/1, 2017 at 10:24
9
Solved
I'm using Laravel and this is my ./phpunit.xml file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.ph...
4
Solved
I am using Laravel 8 and to test my app, I am running
php artisan test --coverage-html reports
The tests are running successfully. The problem is that there is no coverage reports generated. I hav...
Lala asked 30/3, 2021 at 18:11
2
The terminal only tells me There was 1 Warning:. But how can I see the full warning message and where it's being triggered from?
---
this is my phpunit.xml file
<?xml version="1.0"?&g...
Siobhansion asked 15/5, 2021 at 8:7
1
I'm trying to upgrade my application working on Symfony 3.3 and php 7.1 to php 7.2, but I encountered tons of DEPRECATED messages when I run phpunit. Most annoying is:
The "user.user_service" serv...
2
Can I run a PHP script automatically after all PHPUnit tests are finished?
I'd like to report some non-fatal issues (i.e. correct but suboptimal test results) after all tests are finished.
Forensics asked 23/6, 2016 at 8:53
3
Solved
I've read lots of documentation about testing controllers using $this->call($destination, $parameters, 'GET'); but this seems to rely on the route being set up too, and knowing the right $destin...
Delve asked 26/9, 2013 at 13:33
2
I'm starting with PHPUnit, and it works fine so far. I just got one problem:
Eclipse (Oxygen.3) is telling me in this line:
use PHPUnit\Framework\TestCase;
"The import PHPUnit\Framework\TestCase...
6
Solved
I'm trying to use a model factory to make models in a data provider. It works if i use the factory in the setup method or in the test directly, but if I try to use it in a data provider I get an er...
Drunk asked 17/7, 2017 at 8:57
6
Solved
I want to test the delete method but I am not getting the expected results from PHPUnit. I receive this message when running the test:
Expected status code 200 but received 419. Failed asserting ...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.