Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485149
PurgeTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PurgeTest.php
View Options
<?php
namespace
Tests\Feature\Console\AuthAttempt
;
use
Carbon\Carbon
;
use
App\AuthAttempt
;
use
Tests\TestCase
;
class
PurgeTest
extends
TestCase
{
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
AuthAttempt
::
truncate
();
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
AuthAttempt
::
truncate
();
parent
::
tearDown
();
}
/**
* Test command runs
*/
public
function
testHandle
():
void
{
// Warning: We're not using artisan() here, as this will not
// allow us to test "empty output" cases
$cutoff
=
Carbon
::
now
()->
subDays
(
30
);
$user
=
$this
->
getTestUser
(
'john@kolab.org'
);
$authAttempt1
=
AuthAttempt
::
recordAuthAttempt
(
$user
,
"10.0.0.1"
);
$authAttempt1
->
refresh
();
$authAttempt1
->
updated_at
=
$cutoff
->
copy
()->
addDays
(
1
);
$authAttempt1
->
save
([
'timestamps'
=>
false
]);
$authAttempt2
=
AuthAttempt
::
recordAuthAttempt
(
$user
,
"10.0.0.2"
);
$authAttempt2
->
refresh
();
$authAttempt2
->
updated_at
=
$cutoff
->
copy
()->
subDays
(
1
);
$authAttempt2
->
save
([
'timestamps'
=>
false
]);
$code
=
\Artisan
::
call
(
'authattempt:purge'
);
$this
->
assertSame
(
0
,
$code
);
$list
=
AuthAttempt
::
all
();
$this
->
assertCount
(
1
,
$list
);
$this
->
assertSame
(
$authAttempt1
->
id
,
$list
[
0
]->
id
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 1:11 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387368
Default Alt Text
PurgeTest.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment