more tests for Common functions

This commit is contained in:
Abdul Malik Ikhsan 2020-04-17 17:27:16 +07:00
parent 4cf13f4874
commit 4c5ddcae9d
No known key found for this signature in database
GPG Key ID: 23FCCC74D1442CAE

View File

@ -12,6 +12,7 @@ use Config\Logger;
use CodeIgniter\Test\Mock\MockIncomingRequest;
use CodeIgniter\Test\TestLogger;
use CodeIgniter\Test\Mock\MockSession;
use Tests\Support\Models\JobModel;
/**
* @backupGlobals enabled
@ -273,6 +274,18 @@ class CommonFunctionsTest extends \CodeIgniter\Test\CIUnitTestCase
// ------------------------------------------------------------------------
public function testModelNotExists()
{
$this->assertNull(model(UnexsistenceClass::class));
}
public function testModelExists()
{
$this->assertInstanceOf(JobModel::class, model(JobModel::class));
}
// ------------------------------------------------------------------------
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
@ -405,4 +418,15 @@ class CommonFunctionsTest extends \CodeIgniter\Test\CIUnitTestCase
$this->assertTrue($answer1->hasCookie('login_time'));
}
//--------------------------------------------------------------------
public function testTrace()
{
ob_start();
trace();
$content = ob_get_clean();
$this->assertStringContainsString('Debug Backtrace', $content);
}
}