Skip to content

Class 'CodeIgniter\Test\CIUnitTestCase' not found when testing in Appstarter project #1864

Description

@diegoldev

Describe the bug
When trying to run tests CIUnitTestCase is not found
I think that is related to namespace of class inside _support folder, but not sure.

CodeIgniter 4 version
Codeigniter4-beta-0.0.1

Affected module(s)
Testing module

Expected behavior, and steps to reproduce if appropriate

  1. I've installed Codeigniter as appstarter project via composer.
  2. I've created 'tests' folder at project root
  3. I've move '_support' folder insider 'tests' one created at step 2
  4. I've creater '/tests/TestFoo.php' class as described in documentation
  5. When I run 'phpunit' command it's throwing the follow error:
    PHP Fatal error: Uncaught Error: Class 'CIUnitTestCase' not found in /var/www/html/rrhh/tests/TestFoo.php:3 Stack trace: #0 phar:///usr/local/bin/phpunit/phpunit/Util/FileLoader.php(59): include_once() #1 phar:///usr/local/bin/phpunit/phpunit/Util/FileLoader.php(47): PHPUnit\Util\FileLoader::load('/var/www/html/r...') #2 phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php(40): PHPUnit\Util\FileLoader::checkAndLoad('/var/www/html/r...') #3 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(131): PHPUnit\Runner\StandardTestSuiteLoader->load('TestFoo', '/var/www/html/r...') #4 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(78): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('TestFoo', '/var/www/html/r...') #5 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(185): PHPUnit\Runner\BaseTestRunner->getTest('TestFoo', '/var/www/html/r...', Array) #6 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(164): PHPUnit\TextUI\Command->run(Array, true) #7 /usr/local/bin/phpunit( in /var/www/html/rrhh/tests/TestFoo.php on line 3

Context

  • OS: [Debian 9 running on Docker container - host: Windows 10]
  • Web server [Apache 2.4]
  • PHP version [7.3]
  • MySQL [5.7]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions