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

Hi,

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;

use 
CodeIgniter\Test\FeatureTestCase;

class 
TestIndex extends FeatureTestCase
{
    public function setUp(): void
    
{
        parent::setUp();
    }

    public function tearDown(): void
    
{
       parent::tearDown();
    }

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

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


Any ideas or suggestions?
Reply
#2

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

Try renaming your test class to IndexTest
Reply




Theme © iAndrew 2016 - Forum software by © MyBB