mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 09:34:05 +00:00
Fix tests
This commit is contained in:
parent
6ed68dfd7f
commit
e67ce1a3d9
4 changed files with 24 additions and 3 deletions
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests\Feature;
|
||||
|
||||
use Stancl\Tenancy\Tests\TestCase;
|
||||
|
||||
class TenantConfigTest extends TestCase
|
||||
{
|
||||
public $autoInitTenancy = false;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Stancl\Tenancy\Tests\Feature;
|
|||
|
||||
use Route;
|
||||
use Stancl\Tenancy\Tenant;
|
||||
use Stancl\Tenancy\Tests\TestCase;
|
||||
|
||||
class TenantRedirectMacroTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ class TimestampTest extends TestCase
|
|||
public function create_and_update_timestamps_are_added_on_create()
|
||||
{
|
||||
$tenant = Tenant::new()->save();
|
||||
$this->assertArraySubset(['created_at', 'updated_at'], $tenant->data);
|
||||
$this->assertArrayHasKey('created_at', $tenant->data);
|
||||
$this->assertArrayHasKey('updated_at', $tenant->data);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
@ -34,13 +35,22 @@ class TimestampTest extends TestCase
|
|||
{
|
||||
$tenant = Tenant::new()->save();
|
||||
$this->assertSame($tenant->created_at, $tenant->updated_at);
|
||||
$this->assertSame('string', gettype($tenant->created_at));
|
||||
|
||||
sleep(1);
|
||||
|
||||
$this->assert($tenant->updated_at > $tenant->created_at);
|
||||
$tenant->put('abc', 'def');
|
||||
|
||||
$this->assertTrue($tenant->updated_at > $tenant->created_at);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function softdelete_timestamps_are_added()
|
||||
{
|
||||
$this->assertSame();
|
||||
$tenant = Tenant::new()->save();
|
||||
$this->assertNull($tenant->deleted_at);
|
||||
|
||||
$tenant->softDelete();
|
||||
$this->assertNotNull($tenant->deleted_at);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue