Testomatio - Test Management for Codeception
composer require --dev codeception/module-filesystemModule for testing local filesystem. Fork it to extend the module for FTP, Amazon S3, others.
Module was developed to test Codeception itself.
param string $pathreturn voidEnters a directory In local filesystem.
Project root directory is used by default
param string $dirnamereturn voidErases directory contents
<?php
$I->cleanDir('logs');param string $srcparam string $dstreturn voidCopies directory with all contents
<?php
$I->copyDir('vendor','old_vendor');param string $dirnamereturn voidDeletes directory with all subdirectories
<?php
$I->deleteDir('vendor');param string $filenamereturn voidDeletes a file
<?php
$I->deleteFile('composer.lock');return voidDeletes a file
param string $filenameparam string $pathreturn voidChecks if file does not exist in path
param string $textreturn voidChecks If opened file doesn’t contain text in it
<?php
$I->openFile('composer.json');
$I->dontSeeInThisFile('codeception/codeception');param string $filenamereturn voidOpens a file and stores it’s content.
Usage:
<?php
$I->openFile('composer.json');
$I->seeInThisFile('codeception/codeception');param string $textreturn voidChecks the strict matching of file contents.
Unlike seeInThisFile will fail if file has something more than expected lines.
Better to use with HEREDOC strings.
Matching is done after removing “\r” chars from file content.
<?php
$I->openFile('process.pid');
$I->seeFileContentsEqual('3192');param string $filenameparam string $pathreturn voidChecks if file exists in path.
Opens a file when it’s exists
<?php
$I->seeFileFound('UserModel.php','app/models');param string $textreturn voidChecks If opened file has text in it.
Usage:
<?php
$I->openFile('composer.json');
$I->seeInThisFile('codeception/codeception');param int $number New linesreturn voidChecks If opened file has the number of new lines.
Usage:
<?php
$I->openFile('composer.json');
$I->seeNumberNewLines(5);param string $regexreturn voidChecks that contents of currently opened file matches $regex
param string $filenameparam string $contentsreturn voidSaves contents to file