CodeIgniter Forums
Unit test failing, Error: Call to undefined method CodeIgniter\AjaxControllerTest::co - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Unit test failing, Error: Call to undefined method CodeIgniter\AjaxControllerTest::co (/showthread.php?tid=79562)



Unit test failing, Error: Call to undefined method CodeIgniter\AjaxControllerTest::co - manochaaa - 07-02-2021

Code:
<?php

namespace CodeIgniter;
use CodeIgniter\Test\CIUnitTestCase;

class AjaxControllerTest extends CIUnitTestCase
{

  public function testAjax()
  {
    $result = $this->controller(\App\Controllers\Ajax::class)->execute('getFormData');
    $this->assertTrue($result->isOK());
  }

}
?>

This is the source for my test case, I've followed the tutorial from the CI4 website. What am I doing wrong here? I've tried including the ControllerTestTrait with no luck.


RE: Unit test failing, Error: Call to undefined method CodeIgniter\AjaxControllerTest::co - InsiteFX - 07-04-2021

Read:
Test cases for an application which has both php and javascript


RE: Unit test failing, Error: Call to undefined method CodeIgniter\AjaxControllerTest::co - manochaaa - 07-06-2021

Thanks for the reply, but this doesn't really help.