Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485254
DeleteTest.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
DeleteTest.php
View Options
<?php
namespace
Tests\Feature\Console\User
;
use
Tests\TestCase
;
class
DeleteTest
extends
TestCase
{
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
deleteTestUser
(
'user@force-delete.com'
);
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
$this
->
deleteTestUser
(
'user@force-delete.com'
);
parent
::
tearDown
();
}
/**
* Test the command
*/
public
function
testHandle
():
void
{
// Non-existing user
$code
=
\Artisan
::
call
(
"user:delete unknown"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
1
,
$code
);
$this
->
assertSame
(
"No such user unknown"
,
$output
);
$user
=
$this
->
getTestUser
(
'user@force-delete.com'
);
// Test success
$code
=
\Artisan
::
call
(
"user:delete {$user->email}"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
0
,
$code
);
$this
->
assertSame
(
""
,
$output
);
$this
->
assertTrue
(
$user
->
fresh
()->
trashed
());
// User already deleted
$code
=
\Artisan
::
call
(
"user:delete {$user->email}"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
1
,
$code
);
$this
->
assertSame
(
"No such user user@force-delete.com"
,
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 11:47 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387461
Default Alt Text
DeleteTest.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment