• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.