Most voted "phpunit" questions
Phpunit is an open source framework for unit testing, based on Junit, with support for automated testing for PHP
Learn more…33 questions
Sort by count of
-
8
votes1
answer1510
viewsIs there any way to test a route using PHP Unit in Laravel?
I love to create using the PHPunit to create unit tests for my libraries. Always, before doing the git commit, run it to see if any changes affected what was previously working. I wish I could also…
-
4
votes1
answer2094
viewsHow do I set up Netbeans to work with Phpunit in a virtualized environment?
I use Netbeans 7.4 for programming on my Mac. And to not have to install PHP and Phpunit, I would like to run Phpunit installed on a virtual machine that has an entire integration environment…
-
3
votes1
answer494
viewsPhpunit and Selenium - How to call specific functions of the test script?
I need to create several test scripts for WEB using Phpunit and Selenium. I was successful with my initial tests. I even managed to test the login and logout of my website effectively. The problem…
-
3
votes1
answer1786
viewsError "Fatal error: Class 'Phpunit_framework_testcase' not found"
Good evening, I just installed phpunit by a.phar file and adding the path in windows but when I run the tests it returns me the following error: Fatal error: Class 'PHPUnit_Framework_TestCase' not…
-
2
votes3
answers2181
viewsError "class Domdocument not found" when trying to run Phpunit
When trying to turn the command phpunit on the command line, I received the following error: Class 'Domdocument' not found This wasn’t happening before. I remember having removed and installed PHP…
-
2
votes1
answer184
viewsPhpunit not recognized by Cakephp
Now with the discontinuation of Phpunit support by Pear, I started to face a big problem to make Cakephp recognize Phpunit... Phpunit is already installed on my computer (Linux Mint), I can use it…
-
2
votes1
answer117
viewsDoes Phpunit work with Structured Programming?
Good morning, I have a college job that you should do unit tests, and for that I am using Phpunit, the small application that I created to perform these tests is composed only by structured…
-
2
votes1
answer77
viewsphpunit no phpstorm
I’ll run unit tests for phpunit in my stage and I can’t put it in the project. I added the file composer.json and when I will try to add dependency phpunit/phpunit, it presents the following error:…
-
2
votes1
answer323
viewsTesting CRUD made in Laravel with phpunit
Expensive, I have a simple CRUD, appearing only the description field on the screen, and the code is generated by the database. I want to put together a script to test: - inclusion - see if it…
-
2
votes1
answer38
viewsWhy does Phpunit not consider early return in method in code Coverage?
I have a code that I am testing with Phpunit being that in the tested method there is an early return with null under certain condition. However, Phpunit does not consider this part of the code to…
-
2
votes1
answer65
viewsTests with Phpunit in class that uses $_SERVER variable
Hello, all right with you? I created the following class for my own mini-framework (developed for study purposes). <?php declare(strict_types=1); namespace Atlas\Core; final class Request {…
-
1
votes1
answer353
viewsHow to perform mock in a class?
I created this script for testing purposes, and I have a class Calculadora which takes a class instance as a parameter Operacao, when performing the unit test passing the class the test occurs…
-
1
votes0
answers36
viewsDoubt with Phpunit Unit Tests
Guys I’m starting with Phpunit, I’m implementing the first tests in my applications but I’m with the following doubt. All classes should actually be tested, or there are some exceptions, if yes…
-
1
votes1
answer746
viewsCoverage of Unit Tests in Laravel
By starting a repository with a new Laravel 5.5 installation and setting up test coverage and Coveralls for this, despite having only scaffolded the framework authentication and not written a single…
-
1
votes1
answer91
viewsHow to mock the class without passing parameter
Using Phpunit I can mock a class and pass by parameter and test a method is case of selectById. But I can’t mock Acesso and test pessoaLogadaIgualPessoaAtividade. How to take the test of…
-
0
votes0
answers138
viewsPhpunit Dbunit Testcase class not found
Galley When I run a test on phpunit whose class extends from Phpunit Dbunit Testcase I get this message: PHP Fatal error: Class 'PHPUnit\DbUnit\TestCase' not found But when I run a test of a class…
-
0
votes0
answers42
viewsTesting Magic Methods in PHP UNIT
Hello. I need to test the magic methods in PHP UNIT. I’m using the Slim Framework That it’s them __set() __get() __construct() __invoke() handle()
-
0
votes2
answers769
viewsHow to check if the class was instantiated via Dataprovider using PHP Unit
Could someone make an example? Considering my class below: class MinhaClasse { private $param; public function __construct(array $params = []) { $this->param = $params; } } I have my test class:…
-
0
votes1
answer185
viewsTest autoload problem with Phpunit and Composer on Windows
I’m having a problem with the Composer on Windows 7. I developed a project with the following structure: Simpla_HTML |--/src | |--/Simpla | |--/Html | |--/Element.php /---tests | |--/Simpla |…
-
0
votes1
answer44
viewsIs it possible to perform unit tests on PHP functions?
With Phpunit we can perform unit tests in object-oriented code. There is something similar for PHP functions?
-
0
votes1
answer228
viewsUse Phpunit with interactive form
I have a form with Brands, Models and Versions of Cars. I’m using Phpunit to test the form. It works that way: User selects the brand, then the select of templates is loaded and at the end the…
-
0
votes0
answers43
viewsPhpunit call native function once and return stdClass
github.com/Hubtodo/traits/blob/master/tests/Jsonrendertest. p hp I’m doing a successful test of my trait function My trait is this: <?php namespace HubToDo\Traits; use InvalidArgumentException;…
-
0
votes1
answer319
viewsDocker-Compose to create Lamp with phpunit
I am trying to use Docker-Compose to create a LAMP environment along with phpunit to run php TDD and what I intend to do is the following: run a mysql image 5; run a phpunit image 5; run a php 5.6…
-
0
votes1
answer19
viewsUpgrading phpunit v5.1 to V6.5
Hello, I am upgrading phpunit from a 5.1 to 6.5 system, but from the upgrade, the tests that were all working successfully started to fail. The error message is: 1) Tests Administration Controller…
-
0
votes0
answers34
viewsHow to add Laravel HTTP-Tests to a PHP package?
I am creating a PHP package, with Composer for when it is finished being published in Packagist. This package consists of many requests in other Apis, in case I am using the Guzzle. To perform the…
-
0
votes1
answer16
viewsPhpunit : What is the best way to test a list?
I’m doing it this way, but it makes a mistake: public function test_get_list_without_criteria() { $data = ["specialist_name" => "o especialista"]; $data2 = ["specialist_name" => "o…
phpunitasked 6 years, 5 months ago Cardoso Dev 13 -
0
votes2
answers172
viewsGood practice with Phpunit tests
I’m starting tests, and I wanted to know if I’m following correctly, use Portable, and have had some dilemmas to develop a test of a service that I have. He does some operations in an app via API,…
-
0
votes1
answer68
views"The command 'migrate:Fresh' does not exist." in a unit test (phpunit) in Laravel
I am creating unit tests on my system using Sqlite (in memory), but whenever I try to run them, they return the error: 1) Tests\Unit\UserTest::testUserCreate…
-
0
votes1
answer441
viewsUser mock for testing in Laravel/Phpunit
I have a legacy application in Laravel where users can see or not certain system module according to their permissions. These permissions are saved to the database in N:N form and managed in…
-
0
votes1
answer37
viewsHow to configure phpunit with Scrutinizer?
Following the document of Scrutinizer I realized the creation of the archive .scrutinizer.yml in the project in PHP. Analyzing other sites got to the final result of the file demonstrated below:…
-
0
votes1
answer28
viewsYii2 Call to a Member Function getRoute()
I had to make a page using Yii2 at work and at first everything went well, I tested via Postman and the paging works right. $pagination = new Pagination(['totalCount' =>…
-
-1
votes1
answer191
viewsPHP Unit, run database test, mock test and SQL Lite test all together
It’s the following people, work on a huge system, have projects or mini services within a project that we need to test them using Mock, or using PHP’s database or SQL Lite. The problem is that for…
-
-1
votes1
answer540
views