Unit testing with PHPUnit: Using the setUp method (6/10)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

For future viewers just add void on method declaration public function setUp() :void { }

newbieprogrammer
Автор

PHP Fatal error: Declaration of UserTest::setUp() must be compatible with void in on line 10
If you got that error in setUp method, just add :void e.g. "public function setUp(): void".

helloworld
Автор

If you use a text editor to develop php applications. PhpUnit is your friend for finding typo's in the 21 century.
PhpStorm or other editor already would find your typo's and support refactoring, implementing interfaces and other stuff.

RogerKeulen
Автор

Suggestion - add type hinting annotation to $user variable so PHP Storm and other IDE's won't complain on non existing methods i.e. getFirstName(), auto complete will work well and so on:

/**
@var \App\Models\User
*/
protected $user;

golubovicm
Автор

great video, thx, does PHP have private key word?

spicytuna