kenjis/ci-phpunit-test

PHPUnit 9.5.24 + CodeIgniter 3.1.13 + PHP 8.1

myalcin81 opened this issue · 2 comments

  1. Environment: PHPUnit 9.5.24 + Code Igniter 3.1.13 + PHP 8.1
  2. Installed ciphpunit-test versions were 3.03, 3.x-dev, + manual install and with composer (yes, both of them tested)
  3. Manually installed.
  4. Called, vendor/bin/phpunit -c application/tests/
  5. I got following error.
    `PHPUnit 9.5.24 #StandWithUkraine
Error in bootstrap script: Error:
Call to undefined function get_instance()
#0 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/replacing/core/Common.php(360): set_status_header(503)
#1 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/replacing/core/Common.php(408): get_config()
#2 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/CIPHPUnitTest.php(254): config_item('subclass_prefix')
#3 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/CIPHPUnitTest.php(248): CIPHPUnitTest::loadHelper('url_helper')
#4 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/CIPHPUnitTest.php(109): CIPHPUnitTest::replaceHelpers()
#5 /Users/my/Workshop/web/application/tests/_ci_phpunit_test/CIPHPUnitTest.php(70): CIPHPUnitTest::loadCodeIgniter()
#6 /Users/my/Workshop/web/application/tests/Bootstrap.php(389): CIPHPUnitTest::init()
#7 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/Util/FileLoader.php(65): include_once('/Users/my/Works...')
#8 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/Util/FileLoader.php(49): PHPUnit\Util\FileLoader::load('/Users/my/Works...')
#9 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/TextUI/Command.php(562): PHPUnit\Util\FileLoader::checkAndLoad('/Users/my/Works...')
#10 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/TextUI/Command.php(344): PHPUnit\TextUI\Command->handleBootstrap('/Users/my/Works...')
#11 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/TextUI/Command.php(111): PHPUnit\TextUI\Command->handleArguments(Array)
#12 /Users/my/Workshop/web/vendor/phpunit/phpunit/src/TextUI/Command.php(96): PHPUnit\TextUI\Command->run(Array, true)
#13 phpvfscomposer:///Users/my/Workshop/web/vendor/phpunit/phpunit/phpunit(97): PHPUnit\TextUI\Command::main()
#14 /Users/my/Workshop/web/vendor/bin/phpunit(118): include('phpvfscomposer:...')
#15 {main}`

Cannot reproduce.

$ php -v
PHP 8.1.10 (cli) (built: Sep  4 2022 05:02:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.10, Copyright (c) Zend Technologies
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
    with Zend OPcache v8.1.10, Copyright (c), by Zend Technologies
$ composer create-project kenjis/codeigniter-composer-installer ci3
$ cd ci3/
$ composer require phpunit/phpunit --dev
$ composer require kenjis/ci-phpunit-test:3.x-dev --dev
$ php vendor/kenjis/ci-phpunit-test/install.php --from-composer
$ vendor/bin/phpunit -c application/tests/
PHPUnit 9.5.24 #StandWithUkraine

...                                                                 3 / 3 (100%)

Time: 00:00.216, Memory: 12.00 MB

OK (3 tests, 3 assertions)

Generating code coverage report in Clover XML format ... done [00:00.009]

Generating code coverage report in HTML format ... done [00:00.044]

Found the solution in here:
#70
I didn't have a testing folder as well as on the issue #70 my config folder structure was like;
config

  • development/config.php
  • production/config.php