Questions tagged [PHPUnit] (150)

1
answer

How to samokat method phpunit?

Write phpunit test I want to make sure that the delete statement returns exactly what I need. The method delete is called by another private method (canDelete) how to write mock for canDelete ? $data = $service->delete($params);
Maxine.Walk asked April 19th 20 at 12:10
1
answer

How to make unit test for a method of sending messages to Email?

You need to write unit test file mail.php that contains the method to send the message by Email. header("Location: http://landingtaxi/"); $name = $_POST['firstname']; $email = $_POST['email_box']; $col = $_POST['select_col']; if(isset($name) && isset($email) && isset($col)){ switch ($col) { case 2: $c...
enrique35 asked April 18th 20 at 13:16
0
answer

How to write a test for a class with phpunit?

Hi all, I know Zen testing and I have a question. I suppose there is a class class Page { private function getPage(){ $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://example.com/", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOU...
Grover.Howell asked April 16th 20 at 11:17
0
answer

How to samokat class?

class Parser { private $schemaReader; private $fileParser; public function __construct(SchemaReaderInterface $schemaReader, FileParserInterface $fileParser) { $this->schemaReader =$schemaReader; $this->fileParser = $fileParser; } } How to samokat interfaces?
dahlia12 asked April 8th 20 at 10:35
0
answer

During development of the package to connect the test data for each test?

Hi all, I have a package which you want to test. In each test the trait is connected to the connection paths of the migrations and seeders. trait Setup { use WithLoadMigrationsFrom; protected $connectionsToTransact = ['testing']; protected function setUp(): void { parent::setUp(); $this->loadMigrationsFrom(realpa...
marcellu asked April 8th 20 at 09:49
0
answer

How to test a method that takes all time?

I have a method index() which parses a folder where lie json files(specs) and outputs the contents of all json files Which scenario is better I need to protest?
Jettie42 asked April 8th 20 at 09:18
1
answer

Why not apply the settings in phpunit.xml?

<php> <env name="APP_ENV" value="testing"/> <env name="BCRYPT_ROUNDS" value="4"/> <env name="CACHE_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/> <env name="QUEUE_DRIVER" value="sync"/> <env name="MAIL_DRIVER" value="array"/> <env name="DB_CONNECTION" v...
cassidy_Dare asked April 8th 20 at 02:01
0
answer

How to avoid code duplication in the test phpunit?

Created test three methods to test the registration, login, logout (REST API, Laravel Passport), immediately struck by the fact that we have half the code from testLogin copy-paste in testLogout because otherwise the base at the time testLogout will not contain the user (transfer it via @depends does not make sense), there ...
vivien.Legros asked April 7th 20 at 15:35
0
answer

Why has stopped working phpUnit tests?

There are projects a little test, the next run didn't take off, though earlier all was normal. Writes the following on each test: Exception: Serialization of 'Closure' is not allowed In what could be the cause of failure, because previously worked. use php5.6
Rock asked April 7th 20 at 11:40
1
answer

Using Phpunit fixtures?

How to connect the fixtures to the tests? I understand the fixtures is if I understand correctly, let's say the expected value or the original value for comparison in the tests. In the project all connected via composer autoload. How to test a pull up? Using require? Just at the moment I'm testing only the functions without...
Aylin30 asked April 4th 20 at 00:58