kenjis/ci-phpunit-test

Getting an error while running phpunit test

saptarshi-techspro opened this issue · 2 comments

I am getting this error when I am running
this command
../../vendor/bin/phpunit WelcomeTest.php

PHP Fatal error: Declaration of CIPHPUnitTestCase::setUpBeforeClass() must be compatible with PHPUnit\Framework\TestCase::setUpBeforeClass(): void in C:\xampp\htdocs\CodeIgniter-test\ci-test\application\tests_ci_phpunit_test\CIPHPUnitTestCase.php on line 75

I am using
Php :7.4
php unit : PHPUnit 9.3.7
kenjis/ci-phpunit-test: 0.18.0
CI : 3.1.11

My WlcomeTest.php

request('GET', 'welcome/index'); $this->assertStringContainsString( '<title>Welcome to CodeIgniter</title>', $output ); } } Why am i getting this issue I am not sure why am i getting this issue. Please help me .need it urgently.How to solve this issue.I am new to phpunit.

@saptarshi-techspro
If you want to use PHPUnit 8 or later, please use ci-phpunit-test 2.x.
https://github.com/kenjis/ci-phpunit-test/tree/2.x

to fix that you need to change
public static function setUpBeforeClass()
to
public static function setUpBeforeClass(): void
in your test case :)