Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117878515
PlanTest.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
PlanTest.php
View Options
<?php
namespace
Tests\Feature
;
use
App\Entitlement
;
use
App\Plan
;
use
App\Sku
;
use
Tests\TestCase
;
class
PlanTest
extends
TestCase
{
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
Plan
::
where
(
'title'
,
'test-plan'
)->
delete
();
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
Plan
::
where
(
'title'
,
'test-plan'
)->
delete
();
}
/**
* Tests for plan attributes localization
*/
public
function
testPlanLocalization
():
void
{
$plan
=
Plan
::
create
([
'title'
=>
'test-plan'
,
'description'
=>
[
'en'
=>
'Plan-EN'
,
'de'
=>
'Plan-DE'
,
],
'name'
=>
'Test'
,
]);
$this
->
assertSame
(
'Plan-EN'
,
$plan
->
description
);
$this
->
assertSame
(
'Test'
,
$plan
->
name
);
$plan
->
save
();
$plan
=
Plan
::
where
(
'title'
,
'test-plan'
)->
first
();
$this
->
assertSame
(
'Plan-EN'
,
$plan
->
description
);
$this
->
assertSame
(
'Test'
,
$plan
->
name
);
$this
->
assertSame
(
'Plan-DE'
,
$plan
->
getTranslation
(
'description'
,
'de'
));
$this
->
assertSame
(
'Test'
,
$plan
->
getTranslation
(
'name'
,
'de'
));
$plan
->
setTranslation
(
'name'
,
'de'
,
'Prüfung'
)->
save
();
$this
->
assertSame
(
'Prüfung'
,
$plan
->
getTranslation
(
'name'
,
'de'
));
$this
->
assertSame
(
'Test'
,
$plan
->
getTranslation
(
'name'
,
'en'
));
$plan
=
Plan
::
where
(
'title'
,
'test-plan'
)->
first
();
$this
->
assertSame
(
'Prüfung'
,
$plan
->
getTranslation
(
'name'
,
'de'
));
$this
->
assertSame
(
'Test'
,
$plan
->
getTranslation
(
'name'
,
'en'
));
// TODO: Test system locale change
}
/**
* Tests for Plan::hasDomain()
*/
public
function
testHasDomain
():
void
{
$plan
=
Plan
::
where
(
'title'
,
'individual'
)->
first
();
$this
->
assertTrue
(
$plan
->
hasDomain
()
===
false
);
$plan
=
Plan
::
where
(
'title'
,
'group'
)->
first
();
$this
->
assertTrue
(
$plan
->
hasDomain
()
===
true
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 5, 10:17 PM (2 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4f/5e/2e828da0c4f07c9282f691906320
Default Alt Text
PlanTest.php (2 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline