twistersfury / codeception-coverage
Utility Project To Ensure All Classes Have An Equivalent Test File
Package info
gitlab.com/twistersfury/plugins/codecetion-coverage
pkg:composer/twistersfury/codeception-coverage
Requires
- php: ^8.0
Requires (Dev)
- codeception/codeception: ^5.3.5
- codeception/module-asserts: ^3.3.0
- mikey179/vfsstream: ^v1.6.12
This package is not auto-updated.
Last update: 2026-05-07 01:17:47 UTC
README
This module will verify that there is a 1-to-1 relationship between the application files and the unit tests.
Usage
Installation
composer require twistersfury/codception-coverage
Initial Setup
The susgested setup is to create a custom suite called coverages and add the test file there. Otherwise, you can put
it into the Unit Suite instead. If you've never used a custom suite, you can look at this package's tests folder
as an example setup. The key files are coverage.suite.dist.yml and _support/CoverageTester.php in addition to the coverage folder/test.
Create a single file in your unit suite or custom suite with the below contents:
<?php
use TwistersFury\Codeception\Coverage\FileCoverageTest;
class CoverageTest extends FileCoverageTest
{
// Empty Body
}
Configuration
The below example represents the default configuration and can otherwise be omitted for most projects.
modules:
config:
\TwistersFury\Codeception\Coverage\Module:
sourcePath: 'src' # The path to the source files to be scanned.
testPath: 'tests/unit' # The path to the unit tests to check.
###################################################################################################
# The extension to check for. It will automatically skip any files that do not have this extension.
# This module was originally developed for a Zephir based project, which uses the extension .zep.
extension: 'php'
###################################################################################################
# Patterns listed in `ignores` will be excluded from the testing. This allows you to define what
# items get scanned, and what items do not. This is a str_contains match (not regex). Note that
# if you change `extension` above, you'll likely be needing to change `ignores` below.
ignores:
- '/etc'
- 'phalcon_bootstrap.php'
- '/Interfaces/'
- 'Interface.php'
- 'Controller.php'