Welcome Guest, Not a member yet? Register   Sign In
Problems with Unit Testing - HTTP Feature Testing - CI4
#1

Hello, i'm trying to make a simple test using 'HTTP Feature testing' as described in Documentation. But, after hours of trying I couldn't achieve it.

This is my implementation class:

PHP Code:
<?php

namespace App\Controllers;

//use App\Libraries\Traits\ExtendedController;
use CodeIgniter\Controller;

class 
Home extends Controller
{
 
  // use ExtendedController;

 
   public function index()
 
   {
 
       return view('welcome_message');
 
   }



And this is my Test class:
PHP Code:
<?php
namespace Tests;

use 
CodeIgniter\Test\FeatureTestCase;

class 
TestHome extends FeatureTestCase
{

 
   public function setUp()
 
   {
 
       parent::setUp();
 
   }

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

 
   public function testIndex()
 
   {
 
       $result $this->call('get'site_url());
 
       $this->assertSee('Welcome to CodeIgniter');
 
   }


And this is the error thrown:
Code:
There was 1 error:

1) Tests\TestHome::testIndex
CodeIgniter\Exceptions\PageNotFoundException: Controller or its method is not found: App\Controllers\\Http:::ci4.extctrl.docker:8080

/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/Exceptions/PageNotFoundException.php:14
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/CodeIgniter.php:889
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/CodeIgniter.php:249
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/Test/FeatureTestCase.php:122
/var/www/html/ci4-extendedcontroller/tests/TestHome.php:21

In my phpunit.xml, i've defined my env app.baseUrl as:    
Code:
<php>
       <env name="app.baseURL" value="http://ci4.extctrl.docker:8080/"/>
   </php>
Reply


Messages In This Thread
Problems with Unit Testing - HTTP Feature Testing - CI4 - by CiUser - 02-07-2019, 10:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB