Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117882894
SignupCodeTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
SignupCodeTest.php
View Options
<?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'
,
'name'
=>
'User Name'
,
]
];
$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
Details
Attached
Mime Type
text/x-php
Expires
Mon, Apr 6, 12:47 AM (5 d, 5 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c5/69/d2b84ec5aae85553ae3afb319544
Default Alt Text
SignupCodeTest.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline