Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: phpunit coverage report causes Cannot declare class Config\App, because the name is already in use #4114

Closed
kenjis opened this issue Jan 17, 2021 · 19 comments · Fixed by #4157
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@kenjis
Copy link
Member

kenjis commented Jan 17, 2021

Describe the bug
PHPUnit coverage reporting causes:

PHP Fatal error: Cannot declare class Config\App, because the name is already in use in .../app/Config/App.php on line 5

CodeIgniter 4 version
develop branch

Affected module(s)
Which package or class is the bug in, if known.

Expected behavior, and steps to reproduce if appropriate
No errors.

$ composer create-project codeigniter4/appstarter ci4app
$ cd ci4app/
$ php builds development
$ composer update
$ vendor/bin/phpunit
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

PHP Fatal error:  Cannot declare class Config\App, because the name is already in use in /Users/kenji/work/tmp/ci4app/app/Config/App.php on line 5
PHP Stack trace:
PHP   1. {main}() /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/phpunit:61
PHP   3. PHPUnit\TextUI\Command->run($argv = [0 => 'vendor/bin/phpunit'], $exit = TRUE) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/Command.php:163
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = ['default' => [...]]; protected $tests = [0 => class PHPUnit\Framework\TestSuite { ... }, 1 => class PHPUnit\Framework\TestSuite { ... }, 2 => class PHPUnit\Framework\TestSuite { ... }]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [1 => 'PHPUnit\\Runner\\BaseTestRunner', 2 => 'PHPUnit\\Util\\Test', 3 => 'PHPUnit\\Util\\Annotation\\Registry', 4 => 'PHPUnit\\Util\\Annotation\\DocBlock', 5 => 'PHPUnit\\Framework\\TestBuilder', 6 => 'Tests\\Support\\SessionTestCase', 7 => 'Config\\App', 8 => 'SebastianBergmann\\FileIterator\\Facade', 9 => 'PHPUnit\\Util\\VersionComparisonOperator', 10 => 'SebastianBergmann\\FileIterator\\Factory', 11 => 'SebastianBergmann\\FileIterator\\Iterator', 12 => 'Tests\\Support\\DatabaseTestCase', 13 => 'CodeIgniter\\Test\\CIDatabaseTestCase', 14 => 'CodeIgniter\\Test\\CIUnitTestCase', 15 => 'PHPUnit\\Framework\\TestCase', 16 => 'PHPUnit\\Framework\\Assert']; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'CompileError', 5 => 'ParseError', 6 => 'TypeError', 7 => 'ArgumentCountError', 8 => 'ArithmeticError', 9 => 'DivisionByZeroError', 10 => 'Closure', 11 => 'Generator', 12 => 'ClosedGeneratorException', 13 => 'WeakReference', 14 => 'DateTime', 15 => 'DateTimeImmutable', 16 => 'DateTimeZone', 17 => 'DateInterval', 18 => 'DatePeriod', 19 => 'LibXMLError', 20 => 'SQLite3', 21 => 'SQLite3Stmt', 22 => 'SQLite3Result', 23 => 'CURLFile', 24 => 'DOMException', 25 => 'DOMStringList', 26 => 'DOMNameList', 27 => 'DOMImplementationList', 28 => 'DOMImplementationSource', 29 => 'DOMImplementation', 30 => 'DOMNode', 31 => 'DOMNameSpaceNode', 32 => 'DOMDocumentFragment', 33 => 'DOMDocument', 34 => 'DOMNodeList', 35 => 'DOMNamedNodeMap', 36 => 'DOMCharacterData', 37 => 'DOMAttr', 38 => 'DOMElement', 39 => 'DOMText', 40 => 'DOMComment', 41 => 'DOMTypeinfo', 42 => 'DOMUserDataHandler', 43 => 'DOMDomError', 44 => 'DOMErrorHandler', 45 => 'DOMLocator', 46 => 'DOMConfiguration', 47 => 'DOMCdataSection', 48 => 'DOMDocumentType', 49 => 'DOMNotation', 50 => 'DOMEntity', 51 => 'DOMEntityReference', 52 => 'DOMProcessingInstruction', 53 => 'DOMStringExtend', 54 => 'DOMXPath', 55 => 'HashContext', 56 => 'FFI\\Exception', 57 => 'FFI\\ParserException', 58 => 'FFI', 59 => 'FFI\\CData', 60 => 'FFI\\CType', 61 => 'finfo', 62 => 'GMP', 63 => 'LogicException', 64 => 'BadFunctionCallException', 65 => 'BadMethodCallException', 66 => 'DomainException', 67 => 'InvalidArgumentException', 68 => 'LengthException', 69 => 'OutOfRangeException', 70 => 'RuntimeException', 71 => 'OutOfBoundsException', 72 => 'OverflowException', 73 => 'RangeException', 74 => 'UnderflowException', 75 => 'UnexpectedValueException', 76 => 'RecursiveIteratorIterator', 77 => 'IteratorIterator', 78 => 'FilterIterator', 79 => 'RecursiveFilterIterator', 80 => 'CallbackFilterIterator', 81 => 'RecursiveCallbackFilterIterator', 82 => 'ParentIterator', 83 => 'LimitIterator', 84 => 'CachingIterator', 85 => 'RecursiveCachingIterator', 86 => 'NoRewindIterator', 87 => 'AppendIterator', 88 => 'InfiniteIterator', 89 => 'RegexIterator', 90 => 'RecursiveRegexIterator', 91 => 'EmptyIterator', 92 => 'RecursiveTreeIterator', 93 => 'ArrayObject', 94 => 'ArrayIterator', 95 => 'RecursiveArrayIterator', 96 => 'SplFileInfo', 97 => 'DirectoryIterator', 98 => 'FilesystemIterator', 99 => 'RecursiveDirectoryIterator', 100 => 'GlobIterator', 101 => 'SplFileObject', 102 => 'SplTempFileObject', 103 => 'SplDoublyLinkedList', 104 => 'SplQueue', 105 => 'SplStack', 106 => 'SplHeap', 107 => 'SplMinHeap', 108 => 'SplMaxHeap', 109 => 'SplPriorityQueue', 110 => 'SplFixedArray', 111 => 'SplObjectStorage', 112 => 'MultipleIterator', 113 => 'Collator', 114 => 'NumberFormatter', 115 => 'Normalizer', 116 => 'Locale', 117 => 'MessageFormatter', 118 => 'IntlDateFormatter', 119 => 'ResourceBundle', 120 => 'Transliterator', 121 => 'IntlTimeZone', 122 => 'IntlCalendar', 123 => 'IntlGregorianCalendar', 124 => 'Spoofchecker', 125 => 'IntlException', 126 => 'IntlIterator', 127 => 'IntlBreakIterator', ...] }, $arguments = ['listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => [], 'notLoadedExtensions' => [], 'testSuffixes' => [0 => 'Test.php', 1 => '.phpt'], 'configuration' => '/Users/kenji/work/tmp/ci4app/phpunit.xml.dist'], $warnings = [], $exit = TRUE) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/Command.php:204
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:633
PHP   6. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
PHP   7. ExampleDatabaseTest->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
PHP   8. PHPUnit\Framework\TestResult->run($test = class ExampleDatabaseTest { protected $refresh = TRUE; protected $seed = 'Tests\\Support\\Database\\Seeds\\ExampleSeeder'; protected $basePath = '/Users/kenji/work/tmp/ci4app/tests/_support/Database/'; protected $namespace = 'Tests\\Support'; protected $migrate = TRUE; protected $migrateOnce = FALSE; protected $seedOnce = FALSE; protected $DBGroup = 'tests'; protected $db = NULL; protected $migrations = NULL; protected $seeder = NULL; protected $insertCache = []; protected $app = NULL; protected $setUpMethods = [0 => 'resetFactories', 1 => 'mockCache', 2 => 'mockEmail', 3 => 'mockSession']; protected $tearDownMethods = []; protected $backupGlobals = NULL; protected $backupGlobalsBlacklist = []; protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = []; protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ${PHPUnit\Framework\TestCase}data = []; private ${PHPUnit\Framework\TestCase}dataName = ''; private ${PHPUnit\Framework\TestCase}expectedException = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private ${PHPUnit\Framework\TestCase}name = 'testModelFindAll'; private ${PHPUnit\Framework\TestCase}dependencies = []; private ${PHPUnit\Framework\TestCase}dependencyInput = []; private ${PHPUnit\Framework\TestCase}iniSettings = []; private ${PHPUnit\Framework\TestCase}locale = []; private ${PHPUnit\Framework\TestCase}mockObjects = []; private ${PHPUnit\Framework\TestCase}mockObjectGenerator = NULL; private ${PHPUnit\Framework\TestCase}status = -1; private ${PHPUnit\Framework\TestCase}statusMessage = ''; private ${PHPUnit\Framework\TestCase}numAssertions = 0; private ${PHPUnit\Framework\TestCase}result = class PHPUnit\Framework\TestResult { private $passed = [...]; private $errors = [...]; private $failures = [...]; private $warnings = [...]; private $notImplemented = [...]; private $risky = [...]; private $skipped = [...]; private $listeners = [...]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { ... }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { ... }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }; private ${PHPUnit\Framework\TestCase}testResult = NULL; private ${PHPUnit\Framework\TestCase}output = ''; private ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private ${PHPUnit\Framework\TestCase}outputCallback = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingActive = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingLevel = NULL; private ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private ${PHPUnit\Framework\TestCase}snapshot = NULL; private ${PHPUnit\Framework\TestCase}prophet = NULL; private ${PHPUnit\Framework\TestCase}beStrictAboutChangesToGlobalState = NULL; private ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private ${PHPUnit\Framework\TestCase}warnings = []; private ${PHPUnit\Framework\TestCase}groups = [0 => 'default']; private ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private ${PHPUnit\Framework\TestCase}customComparators = []; private ${PHPUnit\Framework\TestCase}doubledTypes = []; private ${PHPUnit\Framework\TestCase}deprecatedExpectExceptionMessageRegExpUsed = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestCase.php:763
PHP   9. SebastianBergmann\CodeCoverage\CodeCoverage->start($id = class ExampleDatabaseTest { protected $refresh = TRUE; protected $seed = 'Tests\\Support\\Database\\Seeds\\ExampleSeeder'; protected $basePath = '/Users/kenji/work/tmp/ci4app/tests/_support/Database/'; protected $namespace = 'Tests\\Support'; protected $migrate = TRUE; protected $migrateOnce = FALSE; protected $seedOnce = FALSE; protected $DBGroup = 'tests'; protected $db = NULL; protected $migrations = NULL; protected $seeder = NULL; protected $insertCache = []; protected $app = NULL; protected $setUpMethods = [0 => 'resetFactories', 1 => 'mockCache', 2 => 'mockEmail', 3 => 'mockSession']; protected $tearDownMethods = []; protected $backupGlobals = NULL; protected $backupGlobalsBlacklist = []; protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = []; protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ${PHPUnit\Framework\TestCase}data = []; private ${PHPUnit\Framework\TestCase}dataName = ''; private ${PHPUnit\Framework\TestCase}expectedException = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private ${PHPUnit\Framework\TestCase}name = 'testModelFindAll'; private ${PHPUnit\Framework\TestCase}dependencies = []; private ${PHPUnit\Framework\TestCase}dependencyInput = []; private ${PHPUnit\Framework\TestCase}iniSettings = []; private ${PHPUnit\Framework\TestCase}locale = []; private ${PHPUnit\Framework\TestCase}mockObjects = []; private ${PHPUnit\Framework\TestCase}mockObjectGenerator = NULL; private ${PHPUnit\Framework\TestCase}status = -1; private ${PHPUnit\Framework\TestCase}statusMessage = ''; private ${PHPUnit\Framework\TestCase}numAssertions = 0; private ${PHPUnit\Framework\TestCase}result = class PHPUnit\Framework\TestResult { private $passed = [...]; private $errors = [...]; private $failures = [...]; private $warnings = [...]; private $notImplemented = [...]; private $risky = [...]; private $skipped = [...]; private $listeners = [...]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { ... }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { ... }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }; private ${PHPUnit\Framework\TestCase}testResult = NULL; private ${PHPUnit\Framework\TestCase}output = ''; private ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private ${PHPUnit\Framework\TestCase}outputCallback = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingActive = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingLevel = NULL; private ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private ${PHPUnit\Framework\TestCase}snapshot = NULL; private ${PHPUnit\Framework\TestCase}prophet = NULL; private ${PHPUnit\Framework\TestCase}beStrictAboutChangesToGlobalState = NULL; private ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private ${PHPUnit\Framework\TestCase}warnings = []; private ${PHPUnit\Framework\TestCase}groups = [0 => 'default']; private ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private ${PHPUnit\Framework\TestCase}customComparators = []; private ${PHPUnit\Framework\TestCase}doubledTypes = []; private ${PHPUnit\Framework\TestCase}deprecatedExpectExceptionMessageRegExpUsed = FALSE }, $clear = *uninitialized*) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestResult.php:646
PHP  10. SebastianBergmann\CodeCoverage\CodeCoverage->initializeData() /Users/kenji/work/tmp/ci4app/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:239
PHP  11. include_once() /Users/kenji/work/tmp/ci4app/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:955

Fatal error: Cannot declare class Config\App, because the name is already in use in /Users/kenji/work/tmp/ci4app/app/Config/App.php on line 5

Call Stack:
    0.0010     398848   1. {main}() /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/phpunit:0
    0.0150     955960   2. PHPUnit\TextUI\Command::main($exit = ???) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/phpunit:61
    0.0150     956088   3. PHPUnit\TextUI\Command->run($argv = [0 => 'vendor/bin/phpunit'], $exit = TRUE) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/Command.php:163
    0.0783    3777288   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = ['default' => [...]]; protected $tests = [0 => class PHPUnit\Framework\TestSuite { ... }, 1 => class PHPUnit\Framework\TestSuite { ... }, 2 => class PHPUnit\Framework\TestSuite { ... }]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [1 => 'PHPUnit\\Runner\\BaseTestRunner', 2 => 'PHPUnit\\Util\\Test', 3 => 'PHPUnit\\Util\\Annotation\\Registry', 4 => 'PHPUnit\\Util\\Annotation\\DocBlock', 5 => 'PHPUnit\\Framework\\TestBuilder', 6 => 'Tests\\Support\\SessionTestCase', 7 => 'Config\\App', 8 => 'SebastianBergmann\\FileIterator\\Facade', 9 => 'PHPUnit\\Util\\VersionComparisonOperator', 10 => 'SebastianBergmann\\FileIterator\\Factory', 11 => 'SebastianBergmann\\FileIterator\\Iterator', 12 => 'Tests\\Support\\DatabaseTestCase', 13 => 'CodeIgniter\\Test\\CIDatabaseTestCase', 14 => 'CodeIgniter\\Test\\CIUnitTestCase', 15 => 'PHPUnit\\Framework\\TestCase', 16 => 'PHPUnit\\Framework\\Assert']; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'CompileError', 5 => 'ParseError', 6 => 'TypeError', 7 => 'ArgumentCountError', 8 => 'ArithmeticError', 9 => 'DivisionByZeroError', 10 => 'Closure', 11 => 'Generator', 12 => 'ClosedGeneratorException', 13 => 'WeakReference', 14 => 'DateTime', 15 => 'DateTimeImmutable', 16 => 'DateTimeZone', 17 => 'DateInterval', 18 => 'DatePeriod', 19 => 'LibXMLError', 20 => 'SQLite3', 21 => 'SQLite3Stmt', 22 => 'SQLite3Result', 23 => 'CURLFile', 24 => 'DOMException', 25 => 'DOMStringList', 26 => 'DOMNameList', 27 => 'DOMImplementationList', 28 => 'DOMImplementationSource', 29 => 'DOMImplementation', 30 => 'DOMNode', 31 => 'DOMNameSpaceNode', 32 => 'DOMDocumentFragment', 33 => 'DOMDocument', 34 => 'DOMNodeList', 35 => 'DOMNamedNodeMap', 36 => 'DOMCharacterData', 37 => 'DOMAttr', 38 => 'DOMElement', 39 => 'DOMText', 40 => 'DOMComment', 41 => 'DOMTypeinfo', 42 => 'DOMUserDataHandler', 43 => 'DOMDomError', 44 => 'DOMErrorHandler', 45 => 'DOMLocator', 46 => 'DOMConfiguration', 47 => 'DOMCdataSection', 48 => 'DOMDocumentType', 49 => 'DOMNotation', 50 => 'DOMEntity', 51 => 'DOMEntityReference', 52 => 'DOMProcessingInstruction', 53 => 'DOMStringExtend', 54 => 'DOMXPath', 55 => 'HashContext', 56 => 'FFI\\Exception', 57 => 'FFI\\ParserException', 58 => 'FFI', 59 => 'FFI\\CData', 60 => 'FFI\\CType', 61 => 'finfo', 62 => 'GMP', 63 => 'LogicException', 64 => 'BadFunctionCallException', 65 => 'BadMethodCallException', 66 => 'DomainException', 67 => 'InvalidArgumentException', 68 => 'LengthException', 69 => 'OutOfRangeException', 70 => 'RuntimeException', 71 => 'OutOfBoundsException', 72 => 'OverflowException', 73 => 'RangeException', 74 => 'UnderflowException', 75 => 'UnexpectedValueException', 76 => 'RecursiveIteratorIterator', 77 => 'IteratorIterator', 78 => 'FilterIterator', 79 => 'RecursiveFilterIterator', 80 => 'CallbackFilterIterator', 81 => 'RecursiveCallbackFilterIterator', 82 => 'ParentIterator', 83 => 'LimitIterator', 84 => 'CachingIterator', 85 => 'RecursiveCachingIterator', 86 => 'NoRewindIterator', 87 => 'AppendIterator', 88 => 'InfiniteIterator', 89 => 'RegexIterator', 90 => 'RecursiveRegexIterator', 91 => 'EmptyIterator', 92 => 'RecursiveTreeIterator', 93 => 'ArrayObject', 94 => 'ArrayIterator', 95 => 'RecursiveArrayIterator', 96 => 'SplFileInfo', 97 => 'DirectoryIterator', 98 => 'FilesystemIterator', 99 => 'RecursiveDirectoryIterator', 100 => 'GlobIterator', 101 => 'SplFileObject', 102 => 'SplTempFileObject', 103 => 'SplDoublyLinkedList', 104 => 'SplQueue', 105 => 'SplStack', 106 => 'SplHeap', 107 => 'SplMinHeap', 108 => 'SplMaxHeap', 109 => 'SplPriorityQueue', 110 => 'SplFixedArray', 111 => 'SplObjectStorage', 112 => 'MultipleIterator', 113 => 'Collator', 114 => 'NumberFormatter', 115 => 'Normalizer', 116 => 'Locale', 117 => 'MessageFormatter', 118 => 'IntlDateFormatter', 119 => 'ResourceBundle', 120 => 'Transliterator', 121 => 'IntlTimeZone', 122 => 'IntlCalendar', 123 => 'IntlGregorianCalendar', 124 => 'Spoofchecker', 125 => 'IntlException', 126 => 'IntlIterator', 127 => 'IntlBreakIterator', ...] }, $arguments = ['listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => [], 'notLoadedExtensions' => [], 'testSuffixes' => [0 => 'Test.php', 1 => '.phpt'], 'configuration' => '/Users/kenji/work/tmp/ci4app/phpunit.xml.dist'], $warnings = [], $exit = TRUE) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/Command.php:204
    0.1120    4410944   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:633
    0.1122    4414232   6. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
    0.1157    4522584   7. ExampleDatabaseTest->run($result = class PHPUnit\Framework\TestResult { private $passed = []; private $errors = []; private $failures = []; private $warnings = []; private $notImplemented = []; private $risky = []; private $skipped = []; private $listeners = [0 => class PHPUnit\Runner\TestListenerAdapter { ... }, 1 => class PHPUnit\TextUI\ResultPrinter { ... }, 2 => class PHPUnit\Util\TestDox\HtmlResultPrinter { ... }, 3 => class PHPUnit\Util\TestDox\TextResultPrinter { ... }, 4 => class PHPUnit\Util\Log\JUnit { ... }]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'app'; protected $groups = [...]; protected $tests = [...]; protected $numTests = -1; protected $testCase = FALSE; protected $foundClasses = [...]; private $cachedNumTests = 5; private $beStrictAboutChangesToGlobalState = NULL; private $iteratorFilter = NULL; private $declaredClasses = [...] }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = TRUE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = [...]; private $ignoredLines = [...]; private $disableIgnoredLines = FALSE; private $tests = [...]; private $unintentionallyCoveredSubclassesWhitelist = [...]; private $isInitialized = TRUE; private $shouldCheckForDeadAndUnused = FALSE; private $report = NULL }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
    0.1157    4522584   8. PHPUnit\Framework\TestResult->run($test = class ExampleDatabaseTest { protected $refresh = TRUE; protected $seed = 'Tests\\Support\\Database\\Seeds\\ExampleSeeder'; protected $basePath = '/Users/kenji/work/tmp/ci4app/tests/_support/Database/'; protected $namespace = 'Tests\\Support'; protected $migrate = TRUE; protected $migrateOnce = FALSE; protected $seedOnce = FALSE; protected $DBGroup = 'tests'; protected $db = NULL; protected $migrations = NULL; protected $seeder = NULL; protected $insertCache = []; protected $app = NULL; protected $setUpMethods = [0 => 'resetFactories', 1 => 'mockCache', 2 => 'mockEmail', 3 => 'mockSession']; protected $tearDownMethods = []; protected $backupGlobals = NULL; protected $backupGlobalsBlacklist = []; protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = []; protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ${PHPUnit\Framework\TestCase}data = []; private ${PHPUnit\Framework\TestCase}dataName = ''; private ${PHPUnit\Framework\TestCase}expectedException = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private ${PHPUnit\Framework\TestCase}name = 'testModelFindAll'; private ${PHPUnit\Framework\TestCase}dependencies = []; private ${PHPUnit\Framework\TestCase}dependencyInput = []; private ${PHPUnit\Framework\TestCase}iniSettings = []; private ${PHPUnit\Framework\TestCase}locale = []; private ${PHPUnit\Framework\TestCase}mockObjects = []; private ${PHPUnit\Framework\TestCase}mockObjectGenerator = NULL; private ${PHPUnit\Framework\TestCase}status = -1; private ${PHPUnit\Framework\TestCase}statusMessage = ''; private ${PHPUnit\Framework\TestCase}numAssertions = 0; private ${PHPUnit\Framework\TestCase}result = class PHPUnit\Framework\TestResult { private $passed = [...]; private $errors = [...]; private $failures = [...]; private $warnings = [...]; private $notImplemented = [...]; private $risky = [...]; private $skipped = [...]; private $listeners = [...]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { ... }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { ... }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }; private ${PHPUnit\Framework\TestCase}testResult = NULL; private ${PHPUnit\Framework\TestCase}output = ''; private ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private ${PHPUnit\Framework\TestCase}outputCallback = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingActive = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingLevel = NULL; private ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private ${PHPUnit\Framework\TestCase}snapshot = NULL; private ${PHPUnit\Framework\TestCase}prophet = NULL; private ${PHPUnit\Framework\TestCase}beStrictAboutChangesToGlobalState = NULL; private ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private ${PHPUnit\Framework\TestCase}warnings = []; private ${PHPUnit\Framework\TestCase}groups = [0 => 'default']; private ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private ${PHPUnit\Framework\TestCase}customComparators = []; private ${PHPUnit\Framework\TestCase}doubledTypes = []; private ${PHPUnit\Framework\TestCase}deprecatedExpectExceptionMessageRegExpUsed = FALSE }) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestCase.php:763
    0.1191    4541384   9. SebastianBergmann\CodeCoverage\CodeCoverage->start($id = class ExampleDatabaseTest { protected $refresh = TRUE; protected $seed = 'Tests\\Support\\Database\\Seeds\\ExampleSeeder'; protected $basePath = '/Users/kenji/work/tmp/ci4app/tests/_support/Database/'; protected $namespace = 'Tests\\Support'; protected $migrate = TRUE; protected $migrateOnce = FALSE; protected $seedOnce = FALSE; protected $DBGroup = 'tests'; protected $db = NULL; protected $migrations = NULL; protected $seeder = NULL; protected $insertCache = []; protected $app = NULL; protected $setUpMethods = [0 => 'resetFactories', 1 => 'mockCache', 2 => 'mockEmail', 3 => 'mockSession']; protected $tearDownMethods = []; protected $backupGlobals = NULL; protected $backupGlobalsBlacklist = []; protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = []; protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ${PHPUnit\Framework\TestCase}data = []; private ${PHPUnit\Framework\TestCase}dataName = ''; private ${PHPUnit\Framework\TestCase}expectedException = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private ${PHPUnit\Framework\TestCase}name = 'testModelFindAll'; private ${PHPUnit\Framework\TestCase}dependencies = []; private ${PHPUnit\Framework\TestCase}dependencyInput = []; private ${PHPUnit\Framework\TestCase}iniSettings = []; private ${PHPUnit\Framework\TestCase}locale = []; private ${PHPUnit\Framework\TestCase}mockObjects = []; private ${PHPUnit\Framework\TestCase}mockObjectGenerator = NULL; private ${PHPUnit\Framework\TestCase}status = -1; private ${PHPUnit\Framework\TestCase}statusMessage = ''; private ${PHPUnit\Framework\TestCase}numAssertions = 0; private ${PHPUnit\Framework\TestCase}result = class PHPUnit\Framework\TestResult { private $passed = [...]; private $errors = [...]; private $failures = [...]; private $warnings = [...]; private $notImplemented = [...]; private $risky = [...]; private $skipped = [...]; private $listeners = [...]; private $runTests = 1; private $time = 0; private $topTestSuite = class PHPUnit\Framework\TestSuite { ... }; private $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { ... }; private $convertDeprecationsToExceptions = TRUE; private $convertErrorsToExceptions = TRUE; private $convertNoticesToExceptions = TRUE; private $convertWarningsToExceptions = TRUE; private $stop = FALSE; private $stopOnError = FALSE; private $stopOnFailure = FALSE; private $stopOnWarning = FALSE; private $beStrictAboutTestsThatDoNotTestAnything = TRUE; private $beStrictAboutOutputDuringTests = FALSE; private $beStrictAboutTodoAnnotatedTests = FALSE; private $beStrictAboutResourceUsageDuringSmallTests = FALSE; private $enforceTimeLimit = FALSE; private $timeoutForSmallTests = 1; private $timeoutForMediumTests = 10; private $timeoutForLargeTests = 60; private $stopOnRisky = FALSE; private $stopOnIncomplete = FALSE; private $stopOnSkipped = FALSE; private $lastTestFailed = FALSE; private $defaultTimeLimit = 0; private $stopOnDefect = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }; private ${PHPUnit\Framework\TestCase}testResult = NULL; private ${PHPUnit\Framework\TestCase}output = ''; private ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private ${PHPUnit\Framework\TestCase}outputCallback = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingActive = FALSE; private ${PHPUnit\Framework\TestCase}outputBufferingLevel = NULL; private ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private ${PHPUnit\Framework\TestCase}snapshot = NULL; private ${PHPUnit\Framework\TestCase}prophet = NULL; private ${PHPUnit\Framework\TestCase}beStrictAboutChangesToGlobalState = NULL; private ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private ${PHPUnit\Framework\TestCase}warnings = []; private ${PHPUnit\Framework\TestCase}groups = [0 => 'default']; private ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private ${PHPUnit\Framework\TestCase}customComparators = []; private ${PHPUnit\Framework\TestCase}doubledTypes = []; private ${PHPUnit\Framework\TestCase}deprecatedExpectExceptionMessageRegExpUsed = FALSE }, $clear = ???) /Users/kenji/work/tmp/ci4app/vendor/phpunit/phpunit/src/Framework/TestResult.php:646
    0.1191    4541384  10. SebastianBergmann\CodeCoverage\CodeCoverage->initializeData() /Users/kenji/work/tmp/ci4app/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:239
    0.1334    4548672  11. include_once('/Users/kenji/work/tmp/ci4app/app/Config/App.php') /Users/kenji/work/tmp/ci4app/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:955

Context

  • OS: [macOS 10.15.7]
  • Web server [n/a]
  • PHP version [7.4.13]
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 17, 2021
@paulbalandan
Copy link
Member

I cannot replicate this. I used your reproduction steps.

PS C:\Users\P\Desktop\Web Dev\ci4app> vendor/bin/phpunit
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

....F                                                               5 / 5 (100%)

Time: 3.15 seconds, Memory: 14.00 MB

There was 1 failure:

1) HealthTest::testBaseUrlHasBeenSet
Failed asserting that false is true.

C:\Users\P\Desktop\Web Dev\ci4app\tests\unit\HealthTest.php:31

FAILURES!
Tests: 5, Assertions: 6, Failures: 1.

@kenjis
Copy link
Member Author

kenjis commented Jan 17, 2021

@paulbalandan Do you have generated coverage report?
Xdebug configured to generate coverage report?

If you generate coverage report, the output would be like this:

$ vendor/bin/phpunit 
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

....F                                                               5 / 5 (100%)

Time: 359 ms, Memory: 14.00 MB

There was 1 failure:

1) HealthTest::testBaseUrlHasBeenSet
Failed asserting that false is true.

/Users/kenji/work/tmp/ci4app/tests/unit/HealthTest.php:31

FAILURES!
Tests: 5, Assertions: 6, Failures: 1.

Generating code coverage report in Clover XML format ... done [77 ms]

Generating code coverage report in HTML format ... done [133 ms]

Generating code coverage report in PHP format ... done [2 ms]


Code Coverage Report:   
  2021-01-17 16:39:04   
                        
 Summary:               
  Classes:  0.00% (0/5) 
  Methods:  0.00% (0/6) 
  Lines:    7.06% (6/85)

\Config::Config\Database
  Methods:   0.00% ( 0/ 1)   Lines:  55.56% (  5/  9)

kenjis added a commit to kenjis/ci4-app-template that referenced this issue Jan 18, 2021
@paulbalandan
Copy link
Member

Yes. With code coverage. And same output with yours.

@samsonasik
Copy link
Member

samsonasik commented Jan 18, 2021

it should already fixed in latest develop #3772

@samsonasik
Copy link
Member

@kenjis I just re-tried, and I can reproduce in PHP 7.4:

➜  ci4app vendor/bin/phpunit
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

PHP Fatal error:  Cannot declare class Config\App, because the name is already in use in /Users/samsonasik/www/ci4app/app/Config/App.php on line 5

Fatal error: Cannot declare class Config\App, because the name is already in use in /Users/samsonasik/www/ci4app/app/Config/App.php on line 5

@paulbalandan
Copy link
Member

I still cannot replicate this on Windows even using the latest develop.

PS C:\Users\P\Desktop\Web Dev\ci4app> vendor/bin/phpunit -v
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.13 with Xdebug 2.9.8
Configuration: C:\Users\P\Desktop\Web Dev\ci4app\phpunit.xml.dist

....F                                                               5 / 5 (100%)

Time: 1.85 seconds, Memory: 14.00 MB

There was 1 failure:

1) HealthTest::testBaseUrlHasBeenSet
Failed asserting that false is true.

C:\Users\P\Desktop\Web Dev\ci4app\tests\unit\HealthTest.php:31

FAILURES!
Tests: 5, Assertions: 6, Failures: 1.

Generating code coverage report in Clover XML format ... done [367 ms]

Generating code coverage report in HTML format ... done [1.76 seconds]

Generating code coverage report in PHP format ... done [44 ms]


Code Coverage Report:
  2021-01-18 02:15:39

 Summary:
  Classes:  0.00% (0/5)
  Methods:  0.00% (0/6)
  Lines:    8.70% (6/69)

\Config::Config\Database
  Methods:   0.00% ( 0/ 1)   Lines:  55.56% (  5/  9)

@samsonasik
Copy link
Member

The strange is when vendor/bin/phpunit with no parameter, it error, when pass tests ( vendor/bin/phpunit tests ) after it, it works:

Screen Shot 2021-01-18 at 15 20 14

@samsonasik
Copy link
Member

samsonasik commented Jan 18, 2021

set processUncoveredFilesFromWhitelist="false" in phpunit.xml somehow fix the issue

@kenjis
Copy link
Member Author

kenjis commented Jan 18, 2021

I don't know it matters or not. I use Xdebug 3.0.

$ php -v
PHP 7.4.13 (cli) (built: Nov 30 2020 14:46:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies

samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue Jan 18, 2021
@samsonasik
Copy link
Member

Yes, I used Xdebug 3 as well, and set processUncoveredFilesFromWhitelist="false" in phpunit.xml somehow fix the issue

@samsonasik
Copy link
Member

@kenjis please verify if #4129 fix it.

samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue Jan 18, 2021
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue Jan 18, 2021
@kenjis
Copy link
Member Author

kenjis commented Jan 18, 2021

@samsonasik vendor/bin/phpunit tests/ causes no errors. Very strange!

Setting processUncoveredFilesFromWhitelist="false" is not good idea.
Because the executed line information is not correct when the config.

processUncoveredFilesFromWhitelist="false" (default) means that a whitelisted file that has no executed lines of code will be added to the code coverage report (if addUncoveredFilesFromWhitelist="true" is set) but it will not be loaded by PHPUnit and it will therefore not be analysed for correct executable lines of code information
https://phpunit.readthedocs.io/en/8.5/code-coverage-analysis.html

So I think work around excluding Config\App kenjis/ci4-app-template@6450dd2 is better.
I don't need the coverage info of Config\App.

@samsonasik
Copy link
Member

Ok, that seems that setting not a solution.

@samsonasik
Copy link
Member

somehow, change testsuite to tests fix it:

<testsuite name="tests"> 

samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue Jan 26, 2021
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue Jan 26, 2021
samsonasik added a commit that referenced this issue Jan 27, 2021
[Develop] Fixes #4114 Cannot declare class Config\App error on running PHPUnit
samsonasik added a commit that referenced this issue Jan 27, 2021
[4.1] Fixes #4114 Cannot declare class Config\App error on running PHPUnit
@rsampat-consultant
Copy link

processUncoveredFilesFromWhitelist

bro this worked for me too !! thanks !!

@samsonasik
Copy link
Member

@rsampat-consultant the solution is change test suit name see #4158

@huanghantao
Copy link

set processUncoveredFilesFromWhitelist="false" in phpunit.xml somehow fix the issue

Thank you !

@thevikas
Copy link

thevikas commented Dec 9, 2023

Sharing my I found the problem to the same issue. I was using Mockery in the test, and the same class was later crashing the phpunit code coverage report generator.
I removed mockery, then coverage was back. I am now rewriting the test differently now.

@davidcorreia
Copy link

@thevikas i had the same problem due to a mock.
these annotations on the class level solved the problem.
https://joelclermont.com/post/2021-01/could-not-load-mock-class-already-exists/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
7 participants