Skip to content

Instantly share code, notes, and snippets.

@CodeAdminDe
Created May 29, 2021 14:12
Show Gist options
  • Save CodeAdminDe/9868377a0e11519ebd0522ffe4bc946f to your computer and use it in GitHub Desktop.
Save CodeAdminDe/9868377a0e11519ebd0522ffe4bc946f to your computer and use it in GitHub Desktop.
Just a simple example of model constant testing via PHPUnit
<?php
namespace Tests\Unit\Models;
use App\Models\User;
use PHPUnit\Framework\TestCase;
class UserConstantsTest extends TestCase
{
/**
* Test values of very important constants to avoid changes without notion.
*
* @return void
*/
public function test_constants_of_role_ids_not_changed_values()
{
$this->assertTrue(1 === User::ROLE_ID_ADMIN);
$this->assertTrue(2 === User::ROLE_ID_SUPPORTER);
$this->assertTrue(3 === User::ROLE_ID_USER);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment