Open metheoryt opened 10 years ago
+1 to this one. Currently, Webception theats StepObjects and PageObjects like tests - which is incorrect, only Cests/Cepts should be.
Actualy, it's quite easy to fix. Taken from here: http://stackoverflow.com/a/20501275
App\Lib\Codeception.php
, method loadTests
:
$exclude = $this->config['ignore'];
/**
* @param \SplFileInfo $file
* @param mixed $key
* @param \RecursiveCallbackFilterIterator $iterator
* @return bool True if you need to recurse or if the item is acceptable
*/
$filter = function ($file, $key, $iterator) use ($exclude)
{
if ($iterator->hasChildren() && !in_array($file->getFilename(), $exclude))
{
return true;
}
return $file->isFile();
};
$files = new \RecursiveIteratorIterator(
new \RecursiveCallbackFilterIterator(
new \RecursiveDirectoryIterator(
"{$this->config['paths']['tests']}/{$type}/",
\FilesystemIterator::SKIP_DOTS
),
$filter
),
\RecursiveIteratorIterator::SELF_FIRST
);
Then this part is not required, as will be filtered in iterator:
if (! in_array($file->getFilename(), $this->config['ignore']) && $file->isFile()) {
Now you can include directories in codeception.php
ignore as well:
'ignore' => array(
'WebGuy.php',
'TestGuy.php',
'CodeGuy.php',
'_bootstrap.php',
'.DS_Store',
'_pages',
'_steps',
),
N.B. _pages
and _steps
are standard namings from Codeception native generator for PageObjects and StepObjects.
Is there a way to ignore some folders in project, like pageObject and stepObject folders?