项目作者: Jimmea

项目描述 :
Sample code phpunit
高级语言: PHP
项目地址: git://github.com/Jimmea/phpunit.git
创建时间: 2020-04-04T11:56:05Z
项目社区:https://github.com/Jimmea/phpunit

开源协议:

下载


Test features

  • Email validate format: valid and invalid

Install

  • Clone project
  • Run composer install
  • Check version phpunit: ./vendor/bin/phpunit --version

Test

1. Test Execution

  1. ./vendor/bin/phpunit tests
  2. PHPUnit 8.0.0 by Sebastian Bergmann and contributors.
  3. ... 3 / 3 (100%)
  4. Time: 70 ms, Memory: 10.00MB
  5. OK (3 tests, 3 assertions)
  • The above assumes that vendor/autoload.php, the autoloader script managed by Composer, exists and is able to load the code for the Email class. Depending on how you set up autoloading, you may need to run composer dump-autoload now.
  • tests instructs the PHPUnit command-line test runner to execute all tests found declared in *Test.php sourcecode files in the tests directory.

2. TestDox

  • Below you see an alternative output which is based on the idea that the name of a test can be used to document the behavior that is verified by the test:
  1. ./vendor/bin/phpunit --testdox tests
  2. PHPUnit 8.0.0 by Sebastian Bergmann and contributors.
  3. Email
  4. Can be created from valid email address
  5. Cannot be created from invalid email address
  6. Can be used as string

3. Organizing Tests

  1. project
  2. ├── composer.json
  3. ├── composer.lock
  4. ├── phpunit.xml.dist
  5. ├── src
  6. └── Calculator.php
  7. └── RemoteConnect
  8. | └── Email
  9. ├── tests
  10. ├── DataTest.php
  11. ├── EmailTest.php
  12. ├── OutputTest.php
  13. ├── RemoteConnectTest.php
  14. └── CalculatorTest.php
  15. └── vendor