Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 846 Bytes

php-unit-may-2024.md

File metadata and controls

34 lines (27 loc) · 846 Bytes

Class Notes: PHP Unit

TODO

  • Update syntax for data providers in the examples (see Class Notes)

Class Notes

Data Providers:

  • The provider method needs to be declared static
  • Need to add a use statement when using PHP 8 attribute notation
use PHPUnit\Framework\Attributes\DataProvider;

Test Doubles

Code Kata IV

The API simulation and data is located here:

/home/vagrant/Zend/api

Errata

  • Correct paths in the last lab
    • API simulator is located in /home/vagrant/Zend/api not under "/completed/api"
    • Also make sure setup() and teardown() declare return type void
  • When using Prophecy you need to add the composer package as follows:
composer require phpspec/prophecy