Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485115
ExpectedTest.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
ExpectedTest.php
View Options
<?php
namespace
Tests\Feature\Console\Wallet
;
use
Illuminate\Support\Facades\Queue
;
use
Tests\TestCase
;
class
ExpectedTest
extends
TestCase
{
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
deleteTestUser
(
'wallets-controller@kolabnow.com'
);
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
$this
->
deleteTestUser
(
'wallets-controller@kolabnow.com'
);
parent
::
tearDown
();
}
/**
* Test command run for a specified wallet
*/
public
function
testHandle
():
void
{
Queue
::
fake
();
$user
=
$this
->
getTestUser
(
'wallets-controller@kolabnow.com'
);
$wallet
=
$user
->
wallets
()->
first
();
// Non-existing user
$code
=
\Artisan
::
call
(
"wallet:expected --user=123"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
1
,
$code
);
$this
->
assertSame
(
"User not found."
,
$output
);
// Expected charges for a specified user
$code
=
\Artisan
::
call
(
"wallet:expected --user={$user->id}"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
0
,
$code
);
$this
->
assertMatchesRegularExpression
(
"|expect charging wallet {$wallet->id} for user {$user->email} with 0|"
,
$output
);
// Test --non-zero argument
$code
=
\Artisan
::
call
(
"wallet:expected --user={$user->id} --non-zero"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
0
,
$code
);
$this
->
assertTrue
(
strpos
(
$output
,
$wallet
->
id
)
===
false
);
// Expected charges for all wallets
$code
=
\Artisan
::
call
(
"wallet:expected"
);
$output
=
trim
(
\Artisan
::
output
());
$this
->
assertSame
(
0
,
$code
);
$this
->
assertMatchesRegularExpression
(
"|expect charging wallet {$wallet->id} for user {$user->email} with 0|"
,
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 1:04 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387226
Default Alt Text
ExpectedTest.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment