Page MenuHomePhorge

SignupCodeTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

SignupCodeTest.php

<?php
namespace Tests\Feature;
use App\SignupCode;
use Carbon\Carbon;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class SignupCodeTest extends TestCase
{
/**
* Test SignupCode creation
*
* @return void
*/
public function testSignupCodeCreate()
{
$data = [
'data' => [
'email' => 'User@email.org',
]
];
$now = Carbon::now();
$code = SignupCode::create($data);
$this->assertFalse($code->isExpired());
$this->assertTrue(strlen($code->code) === SignupCode::CODE_LENGTH);
$this->assertTrue(
strlen($code->short_code) === env(
'VERIFICATION_CODE_LENGTH',
SignupCode::SHORTCODE_LENGTH
)
);
$this->assertSame($data['data'], $code->data);
$this->assertInstanceOf(Carbon::class, $code->expires_at);
$this->assertSame(
env('SIGNUP_CODE_EXPIRY', SignupCode::CODE_EXP_HOURS),
$code->expires_at->diffInHours($now) + 1
);
$inst = SignupCode::find($code->code);
$this->assertInstanceOf(SignupCode::class, $inst);
$this->assertSame($inst->code, $code->code);
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Jul 8, 10:10 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1052127
Default Alt Text
SignupCodeTest.php (1 KB)

Event Timeline