Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120835849
SkuTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
SkuTest.php
View Options
<?php
namespace
Tests\Feature
;
use
App\Entitlement
;
use
App\Handlers
;
use
App\Package
;
use
App\Sku
;
use
Carbon\Carbon
;
use
Tests\TestCase
;
class
SkuTest
extends
TestCase
{
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
deleteTestUser
(
'jane@kolabnow.com'
);
}
public
function
tearDown
():
void
{
$this
->
deleteTestUser
(
'jane@kolabnow.com'
);
parent
::
tearDown
();
}
public
function
testPackageEntitlements
():
void
{
$user
=
$this
->
getTestUser
(
'jane@kolabnow.com'
);
$wallet
=
$user
->
wallets
()->
first
();
$package
=
Package
::
where
(
'title'
,
'lite'
)->
first
();
$sku_mailbox
=
Sku
::
where
(
'title'
,
'mailbox'
)->
first
();
$sku_storage
=
Sku
::
where
(
'title'
,
'storage'
)->
first
();
$user
=
$user
->
assignPackage
(
$package
);
$this
->
backdateEntitlements
(
$user
->
fresh
()->
entitlements
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
1
));
$wallet
->
chargeEntitlements
();
$this
->
assertTrue
(
$wallet
->
balance
<
0
);
}
public
function
testSkuEntitlements
():
void
{
$this
->
assertCount
(
4
,
Sku
::
where
(
'title'
,
'mailbox'
)->
first
()->
entitlements
);
}
public
function
testSkuPackages
():
void
{
$this
->
assertCount
(
2
,
Sku
::
where
(
'title'
,
'mailbox'
)->
first
()->
packages
);
}
public
function
testSkuHandlerDomainHosting
():
void
{
$sku
=
Sku
::
where
(
'title'
,
'domain-hosting'
)->
first
();
$entitlement
=
$sku
->
entitlements
->
first
();
$this
->
assertSame
(
Handlers\DomainHosting
::
entitleableClass
(),
$entitlement
->
entitleable_type
);
}
public
function
testSkuHandlerMailbox
():
void
{
$sku
=
Sku
::
where
(
'title'
,
'mailbox'
)->
first
();
$entitlement
=
$sku
->
entitlements
->
first
();
$this
->
assertSame
(
Handlers\Mailbox
::
entitleableClass
(),
$entitlement
->
entitleable_type
);
}
public
function
testSkuHandlerStorage
():
void
{
$sku
=
Sku
::
where
(
'title'
,
'storage'
)->
first
();
$entitlement
=
$sku
->
entitlements
->
first
();
$this
->
assertSame
(
Handlers\Storage
::
entitleableClass
(),
$entitlement
->
entitleable_type
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:22 PM (1 d, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
18/fa/37432ab1b90d1c64a111bcb2d5ee
Default Alt Text
SkuTest.php (2 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline