Skip to content

replace dbunit

Yosuke Kushida edited this page Mar 7, 2019 · 2 revisions

Update phpunit7 + dbunit4 to phpunit8 + this

Check versions.

$ composer show | grep "phpunit\|dbunit"
phpunit/dbunit                     4.0.0   PHPUnit extension for database interaction testing
phpunit/php-code-coverage          6.1.4   Library that provides collection, processing, and rendering functiona...
phpunit/php-file-iterator          2.0.2   FilterIterator implementation that filters files based on a list of s...
phpunit/php-text-template          1.2.1   Simple template engine.
phpunit/php-timer                  2.0.0   Utility class for timing
phpunit/php-token-stream           3.0.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    7.5.2   The PHP Unit Testing framework.

Remove phpunit/dbunit from composer.json

$ composer remove phpunit/dbunit --no-update

Check dependency libraries.

$ composer update --dry-run
    1/3:        http://repo.packagist.org/p/provider-latest$24f8a02ed302af3f666d170689c4cd591444d650f368a952420d95389a3eefd0.json
    2/3:        http://repo.packagist.org/p/provider-2018-10$dc867fc07424f9a04549e0adbbe6669e786792d3120128024cd0d4108460b5fb.json
    3/3:        http://repo.packagist.org/p/provider-2019-01$2477680c5fb73a1b4b197f8220342d48094c150ae9ab5c18789d7923956c5476.json
    Finished: success: 3, skipped: 0, failure: 0, total: 3
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 4 updates, 2 removals
  - Uninstalling symfony/yaml (v4.2.2)
  - Uninstalling phpunit/dbunit (4.0.0)
  - Updating sebastian/environment (4.0.1) to sebastian/environment (4.1.0)
  - Updating sebastian/diff (3.0.1) to sebastian/diff (3.0.2)
  - Updating phpunit/php-timer (2.0.0) to phpunit/php-timer (2.1.1)
  - Updating phpunit/phpunit (7.5.2) to phpunit/phpunit (7.5.6)

Remove phpunit/dbunit and dependencies.

$ composer update symfony/yaml phpunit/dbunit

Removed.

$ composer show | grep "phpunit\|dbunit"
phpunit/php-code-coverage          6.1.4   Library that provides collection, processing, and rendering functiona...
phpunit/php-file-iterator          2.0.2   FilterIterator implementation that filters files based on a list of s...
phpunit/php-text-template          1.2.1   Simple template engine.
phpunit/php-timer                  2.0.0   Utility class for timing
phpunit/php-token-stream           3.0.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    7.5.2   The PHP Unit Testing framework.

Prepare for phpunit/phpunit major version update.
"phpunit/phpunit":"^7.0""phpunit/phpunit":"^8.0"

Update phpunit/phpunit

$ composer update phpunit/phpunit --with-dependencies

Updated.

$ composer show | grep "phpunit\|dbunit"
phpunit/php-code-coverage          7.0.3   Library that provides collection, processing, and rendering functiona...
phpunit/php-file-iterator          2.0.2   FilterIterator implementation that filters files based on a list of s...
phpunit/php-text-template          1.2.1   Simple template engine.
phpunit/php-timer                  2.1.1   Utility class for timing
phpunit/php-token-stream           3.0.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    8.0.4   The PHP Unit Testing framework.

Add repository to composer.json

"repositories": [
    { "type": "vcs", "url": "https://github.com/iamapen/dbunit" }
]

Install this.

$ composer require iamapen/dbunit

Installed.

$ composer show | grep "phpunit\|dbunit"
iamapen/dbunit                     5.0.1   PHPUnit extension for database interaction testing
phpunit/php-code-coverage          7.0.3   Library that provides collection, processing, and rendering functiona...
phpunit/php-file-iterator          2.0.2   FilterIterator implementation that filters files based on a list of s...
phpunit/php-text-template          1.2.1   Simple template engine.
phpunit/php-timer                  2.1.1   Utility class for timing
phpunit/php-token-stream           3.0.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    8.0.4   The PHP Unit Testing framework.
Clone this wiki locally