Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
174
Issues
174
List
Boards
Labels
Service Desk
Milestones
Merge Requests
43
Merge Requests
43
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
5f801ecc
Commit
5f801ecc
authored
4 minutes ago
by
Ben Hayward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test update
parent
4bbbf6eb
feat/plus-tiers-578
1 merge request
!279
[Sprint/JollyJellyfish](feat): Added plus tiers to endpoint and passed through #578
Pipeline
#72129790
running with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
Plus.php
Core/Wire/Delegates/Plus.php
+2
-1
PlusSpec.php
Spec/Core/Wire/Delegates/PlusSpec.php
+38
-1
No files found.
Core/Wire/Delegates/Plus.php
View file @
5f801ecc
...
...
@@ -89,7 +89,8 @@ class Plus
* @param [Integer] $previousTimestamp - the users previous subscription unix timestamp.
* @return [Integer] the new unix expiry date.
*/
public
function
calculatePlusExpires
(
$timespan
,
$wireTimestamp
,
$previousTimestamp
=
null
)
{
public
function
calculatePlusExpires
(
$timespan
,
$wireTimestamp
,
$previousTimestamp
=
null
)
{
if
(
$previousTimestamp
===
9999999999
)
{
throw
new
\Exception
(
'Already existing lifetime subscription'
);
}
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Wire/Delegates/PlusSpec.php
View file @
5f801ecc
...
...
@@ -145,7 +145,8 @@ class PlusSpec extends ObjectBehavior
}
function
it_should_not_make_a_user_plus_if_onchain_wire_wrong
(
Config
$config
Config
$config
,
User
$sender
)
{
$this
->
beConstructedWith
(
$config
);
...
...
@@ -176,4 +177,40 @@ class PlusSpec extends ObjectBehavior
$wire
->
getSender
()
->
isPlus
()
->
shouldBe
(
false
);
}
function
it_should_return_expiry_time_for_not_plus_already_subscriber_one_month
()
{
$wireTimestamp
=
time
();
$previousTimestamp
=
10000
;
$this
->
calculatePlusExpires
(
"+30 days"
,
$wireTimestamp
,
$previousTimestamp
)
->
shouldEqualApproximately
(
strtotime
(
'+30 days'
,
time
()),
1.0e-9
);
}
function
it_should_return_expiry_time_for_not_plus_already_subscriber_one_year
()
{
$wireTimestamp
=
time
();
$previousTimestamp
=
10000
;
$this
->
calculatePlusExpires
(
"+1 year"
,
$wireTimestamp
,
$previousTimestamp
)
->
shouldEqualApproximately
(
strtotime
(
'+1 year'
,
time
()),
1.0e-9
);
}
function
it_should_return_expiry_time_for_existing_1_year_plus_a_new_month
()
{
$wireTimestamp
=
time
();
$previousTimestamp
=
strtotime
(
'+11 months'
,
time
());
//already subbed for the next 11 momths
$this
->
calculatePlusExpires
(
"+1 month"
,
$wireTimestamp
,
$previousTimestamp
)
->
shouldEqualApproximately
(
strtotime
(
'+1 year'
,
time
()),
1.0e-9
);
}
function
it_should_return_expiry_time_for_existing_monthly_subscription_upgrade_to_year
()
{
$wireTimestamp
=
time
();
$previousTimestamp
=
strtotime
(
'+1 months'
,
time
());
//already subbed for the next 11 month
$this
->
calculatePlusExpires
(
"+1 year"
,
$wireTimestamp
,
$previousTimestamp
)
->
shouldEqualApproximately
(
strtotime
(
'+13 months'
,
time
()),
1.0e-9
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment