CodeIgniter Forums

Full Version: Problems with Unit Testing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I want to make some unit tests but allways get an error:

CodeIgniter\Exceptions\PageNotFoundException: Controller or its method is not found: \App\Controllers\Tests::codeigniter

but I dont want to test the Tests Controller

PHP Code:
<?php

namespace App;

use 
CodeIgniter\Test\FeatureTestCase ;

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

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

    public function testIndex(){

        $this->get("/");
    }


(04-16-2021, 05:54 PM)pilly100 Wrote: [ -> ]Hello,

I want to make some unit tests but allways get an error:

CodeIgniter\Exceptions\PageNotFoundException: Controller or its method is not found: \App\Controllers\Tests::codeigniter

but I dont want to test the Tests Controller

PHP Code:
<?php

namespace App;

use 
CodeIgniter\Test\FeatureTestCase ;

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

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

    public function testIndex(){

        $this->get("/");
    }




The problem is I installed it in a subfolder tests/codeigniter ...

is it possible to test the application in a subfolder?
i found an opportunity to test it in a subfolder

change:
framework/system/Test/FeatureTestTrait.php
Line 310
$uri    = new URI(rtrim($config->baseURL, '/') . '/' . trim($path, '/ '));
to
$uri    = new URI('/' . trim($path, '/ '));

now you it is posible to test in subfolders

 Smile