3åã§CodeIgniter 3.xããPHPUnit 6.0ã使ã
PHPUnit 6.0ããªãªã¼ã¹ãããããã§ãããCodeIgniter 3.xã§ããã¡ãã使ãã¾ãã
ãªããPHPUnit 6.0ã使ãã«ã¯PHP 7.0以ä¸ãå¿ è¦ã§ãã
CodeIgniterã®ã¤ã³ã¹ãã¼ã«
ComposerããCodeIgniter 3.xã®ææ°çãã¤ã³ã¹ãã¼ã«ãã¾ãã
$ composer create-project kenjis/codeigniter-composer-installer ci31
以ä¸ã®ããã«ãç¾å¨ã ã¨CodeIgniter 3.1.3ãã¤ã³ã¹ãã¼ã«ããã¾ãã
Installing kenjis/codeigniter-composer-installer (v0.4.6)
- Installing kenjis/codeigniter-composer-installer (v0.4.6)
Loading from cache
Created project in ci31
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing codeigniter/framework (3.1.3)
Loading from cache
kenjis/codeigniter-composer-installer suggests installing kenjis/codeigniter-cli (A command-line tool for CodeIgniter 3.0)
kenjis/codeigniter-composer-installer suggests installing kenjis/ci-phpunit-test (An easier way to use PHPUnit with CodeIgniter 3.0)
kenjis/codeigniter-composer-installer suggests installing kenjis/codeigniter-ss-twig (A Simple and Secure Twig integration for CodeIgniter 3.0)
kenjis/codeigniter-composer-installer suggests installing kenjis/codeigniter-doctrine (A simple Doctrine integration for CodeIgniter 3.0)
kenjis/codeigniter-composer-installer suggests installing kenjis/codeigniter-deployer (A Deployment Tool for CodeIgniter 3.0)
codeigniter/framework suggests installing paragonie/random_compat (Provides better randomness in PHP 5.x)
Writing lock file
Generating autoload files
> Kenjis\CodeIgniter\Installer::postInstall
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing mikey179/vfsstream (v1.1.0)
Loading from cache
Writing lock file
Generating autoload files
==================================================
`public/.htaccess` was installed. If you don't need it, please remove it.
If you want to install translations for system messages or some third party libraries,
$ cd <codeigniter_project_folder>
$ php bin/install.php
Above command will show help message.
See <https://github.com/kenjis/codeigniter-composer-installer> for details
==================================================
PHPUnit 6.0ã®ã¤ã³ã¹ãã¼ã«
ComposerããPHPUnit 6.0ãã¤ã³ã¹ãã¼ã«ãã¾ãã
$ cd ci31/
$ composer require phpunit/phpunit:6.0.*
以ä¸ã®ããã«ãç¾å¨ã ã¨PHPUnit 6.0.6ãã¤ã³ã¹ãã¼ã«ããã¾ãã
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing sebastian/version (2.0.1)
Loading from cache
- Installing sebastian/resource-operations (1.0.0)
Loading from cache
- Installing sebastian/recursion-context (2.0.0)
Loading from cache
- Installing sebastian/object-enumerator (2.0.0)
Loading from cache
- Installing sebastian/global-state (1.1.1)
Loading from cache
- Installing sebastian/exporter (2.0.0)
Loading from cache
- Installing sebastian/environment (2.0.0)
Loading from cache
- Installing sebastian/diff (1.4.1)
Loading from cache
- Installing sebastian/comparator (1.2.4)
Loading from cache
- Installing doctrine/instantiator (1.0.5)
Loading from cache
- Installing phpunit/php-text-template (1.2.1)
Loading from cache
- Installing phpunit/phpunit-mock-objects (4.0.0)
Loading from cache
- Installing phpunit/php-timer (1.0.8)
Loading from cache
- Installing phpunit/php-file-iterator (1.4.2)
Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.0)
Loading from cache
- Installing phpunit/php-token-stream (1.4.9)
Loading from cache
- Installing phpunit/php-code-coverage (5.0.0)
Loading from cache
- Installing webmozart/assert (1.2.0)
Loading from cache
- Installing phpdocumentor/reflection-common (1.0)
Loading from cache
- Installing phpdocumentor/type-resolver (0.2.1)
Loading from cache
- Installing phpdocumentor/reflection-docblock (3.1.1)
Loading from cache
- Installing phpspec/prophecy (v1.6.2)
Loading from cache
- Installing myclabs/deep-copy (1.6.0)
Loading from cache
- Installing phpunit/phpunit (6.0.6)
Loading from cache
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files
ci-phpunit-testã®ã¤ã³ã¹ãã¼ã«
CodeIgniterããPHPUnitãç°¡åã«ä½¿ãããã«ãci-phpunit-testãã¤ã³ã¹ãã¼ã«ãã¾ãããªããPHPUnit 6.0ã使ãããã«ã¯ãci-phpunit-test 0.14.0以ä¸ãå¿ è¦ã§ãã
$ composer require kenjis/ci-phpunit-test --dev
以ä¸ã®ããã«ãç¾å¨ã ã¨ci-phpunit-test 0.14.0ãã¤ã³ã¹ãã¼ã«ããã¾ãã
Using version ^0.14.0 for kenjis/ci-phpunit-test
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing nikic/php-parser (v3.0.4)
Downloading: 100%
- Installing kenjis/ci-phpunit-test (v0.14.0)
Downloading: 100%
Writing lock file
Generating autoload files
å®ã¯ããã ãã§ã¯ã¾ã ã¤ã³ã¹ãã¼ã«ãå®äºãã¾ããã以ä¸ã®ã³ãã³ããå®è¡ãã¾ãã
$ php vendor/kenjis/ci-phpunit-test/install.php
ããã§ãci-phpunit-testãã¤ã³ã¹ãã¼ã«ããã¾ããã
PHPUnitã®å®è¡
$ vendor/bin/phpunit -c application/tests/ --debug
以ä¸ã®ããã«ãci-phpunit-testã«ä»å±ãã¦ãããµã³ãã«ã®ãã¹ããå®è¡ããã¾ãã
PHPUnit 6.0.6 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
Starting test 'Welcome_test::test_index'.
.
Starting test 'Welcome_test::test_method_404'.
.
Starting test 'Welcome_test::test_APPPATH'.
. 3 / 3 (100%)
Time: 80 ms, Memory: 4.00MB
OK (3 tests, 3 assertions)
é¢é£
Date: 2017/02/15