Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120835753
TenantTest.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
TenantTest.php
View Options
<?php
namespace
Tests\Feature
;
use
App\Tenant
;
use
App\TenantSetting
;
use
Tests\TestCase
;
class
TenantTest
extends
TestCase
{
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
TenantSetting
::
truncate
();
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
TenantSetting
::
truncate
();
parent
::
tearDown
();
}
/**
* Test Tenant::getConfig() method
*/
public
function
testGetConfig
():
void
{
// No tenant id specified
$this
->
assertSame
(
\config
(
'app.name'
),
Tenant
::
getConfig
(
null
,
'app.name'
));
$this
->
assertSame
(
\config
(
'app.env'
),
Tenant
::
getConfig
(
null
,
'app.env'
));
$this
->
assertSame
(
null
,
Tenant
::
getConfig
(
null
,
'app.unknown'
));
$tenant
=
Tenant
::
whereNotIn
(
'id'
,
[
\config
(
'app.tenant_id'
)])->
first
();
$tenant
->
setSetting
(
'app.test'
,
'test'
);
// Tenant specified
$this
->
assertSame
(
$tenant
->
title
,
Tenant
::
getConfig
(
$tenant
->
id
,
'app.name'
));
$this
->
assertSame
(
'test'
,
Tenant
::
getConfig
(
$tenant
->
id
,
'app.test'
));
$this
->
assertSame
(
\config
(
'app.env'
),
Tenant
::
getConfig
(
$tenant
->
id
,
'app.env'
));
$this
->
assertSame
(
null
,
Tenant
::
getConfig
(
$tenant
->
id
,
'app.unknown'
));
}
/**
* Test Tenant::wallet() method
*/
public
function
testWallet
():
void
{
$tenant
=
Tenant
::
find
(
\config
(
'app.tenant_id'
));
$user
=
\App\User
::
where
(
'email'
,
'reseller@'
.
\config
(
'app.domain'
))->
first
();
$wallet
=
$tenant
->
wallet
();
$this
->
assertInstanceof
(
\App\Wallet
::
class
,
$wallet
);
$this
->
assertSame
(
$user
->
wallets
->
first
()->
id
,
$wallet
->
id
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:21 PM (1 d, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
da/ed/a77bdf9292d3c1157e7431d057b0
Default Alt Text
TenantTest.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline