Answer the question
In order to leave comments, you need to log in
How to make friends Yii2 and Codeception with coverage?
Good afternoon. There was a need to cover your REST API with tests, and at the same time see the code coverage with these tests. I kind of figured out how to write a simple test with a REST call, but --coverage-html
it doesn’t work out with stubbornness!
I'm using Yii2-basic as a base, installed all required dependencies. I have Codecept globally from composer (installed in include_path).
It is not clear to me how c3.php works and how to connect it to the project so that it starts working adequately.
Here are my configs:
tests/codeception.yml
actor: Tester
paths:
tests: codeception
log: codeception/_output
data: codeception/_data
helpers: codeception/_support
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
memory_limit: 1024M
log: true
colors: true
config:
test_entry_url: 'http://site.local/index-test.php'
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- REST
config:
PhpBrowser:
url: http://site.local
coverage:
enabled: true
remote: true
c3_url: 'http://site.local/index-test.php'
// include composer vendor
include 'vendor/autoload.php';
$_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG'] = 1;
$_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'] = '/../tests/codeception.yml';
location /c3/ {
try_files /c3.php?$args /c3.php;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question