From 8ec87126dc9cd11c94ccd25c37986d428cfcac65 Mon Sep 17 00:00:00 2001 From: Susann Sgorzaly Date: Wed, 14 Feb 2018 12:12:53 +0100 Subject: [PATCH] load files from extensions folder for tests; added new property in worthless_test --- tests/Bootstrap.php | 11 +++++++++++ tests/properties/worthless_test.php | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 0999d1c..64ff13b 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -3,9 +3,20 @@ $dir = realpath(__DIR__); defined('BASE') OR define('BASE', dirname($dir) . '/'); +recursivelyIncludeFiles(BASE . 'extensions'); + require_once BASE . 'parsecsv.lib.php'; if (!class_exists('PHPUnit\Framework\TestCase')) { // we run on an older PHPUnit version without namespaces. require_once __DIR__ . '/PHPUnit_Framework_TestCase.inc.php'; } + +function recursivelyIncludeFiles($pathName){ + $dirIterator = new RecursiveDirectoryIterator($pathName); + foreach ($dirIterator as $dir) { + if ($dir->isFile() && $dir->getExtension() === 'php') { + require_once $dir->getPathname(); + } + } +} diff --git a/tests/properties/worthless_test.php b/tests/properties/worthless_test.php index 411e91d..5459b59 100644 --- a/tests/properties/worthless_test.php +++ b/tests/properties/worthless_test.php @@ -107,7 +107,8 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase { 'error', 'error_info', 'titles', - 'data' + 'data', + 'data_types', ); // Find our real properties @@ -129,7 +130,8 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase { public function test_count_public_properties() { $counter = 0; - for ($a = 0; $a < count($this->properties); $a++) { + $propertiesCount = count($this->properties); + for ($a = 0; $a < $propertiesCount; $a++) { if ($this->properties[$a]->isPublic() === true) { $counter++; }