Sunday 9 December 2018

PHPUNIT

Like Composer PHPUNIT can be installed on a project bases

// Get PHP unit
#  composer require --dev phpunit/phpunit ^7

// Output version
# ./vendor/bin/phpunit --version

// update composer json
{
    "autoload": {
        "classmap": [
            "src/"
        ]
    },
    "require-dev": {
        "phpunit/phpunit": "^7"
    }
}

// Create test code based on documnetation ...
// For example create tests in tests/EmailTest.php

// Run tests
#./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/EmailTest


Sources
PHP UNIT Official

No comments:

Post a Comment