Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 4 Testing Problems


I'm new to CodeIgniter 4 and testing. I am developing my project using this framework.
I'm having hard time trying to get my tests to run.

I have used app starter to start the project

Yes I searched the forum for answers.
Yes basic sample tests are running fine
Yes I have read the docs
Yes I configured .env file to development
Yes I looked through sample tests attached.

I'm getting PHPunit warnings:

1) Warning

No tests found in class "CodeIgniter\Test\FeatureTestCase".

Then i get error on my test like:
1) App\FeatureTests\TestIndex::testIfIndexDisplaysLoginPage

ErrorException: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Maybe someone more experienced can assist me:
I wrote my first basic test to feature test first http response from where my user lands on login page like this:

PHP Code:
<?php namespace App\FeatureTests;


TestIndex extends FeatureTestCase
    public function setUp(): void

    public function tearDown(): void

    public function testIfIndexDisplaysLoginPage()
        $result $this->get('/');

        $result->assertContains('Please sign in');

Any ideas or suggestions?

Hello, I got the same problem. Did you find a solution ? Thanks

Try renaming your test class to IndexTest

Theme © iAndrew 2016 - Forum software by © MyBB