Inhaltsverzeichnis

Back to Yii2 Overview

Yii2 Testing

This page contains my notes about learning testing with Yii2. My environment is Windows 7.

Yii2 uses PHPUnit and Codeception to run tests.

Test Types

Unit Tests

Unit tests are usually developed by people who write the classes being tested.

Functional Tests

Functional tests are generally faster than acceptance tests.

Requirements

Config Files

tests/Acceptance.suite.yaml
class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            url: http://localhost:8080/
            browser: chrome
        - Yii2:
            part: orm
            entryScript: index-test.php
            cleanup: false

Console

Chrome Driver

Running Tests

$ HTTP_PROXY= && vendor/bin/codecept run