Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
218
Issues
218
List
Boards
Labels
Service Desk
Milestones
Merge Requests
30
Merge Requests
30
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
4ef022e1
Commit
4ef022e1
authored
8 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): resolve backend tests for new wire features
parent
9658b9c8
epic/37-wire
1 merge request
!254
WIP: &37 - Multi-currency
Pipeline
#77308486
running with stages
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
309 additions
and
324 deletions
+309
-324
PaymentSpec.php
Spec/Core/Boost/PaymentSpec.php
+258
-258
ManagerSpec.php
Spec/Core/Wire/ManagerSpec.php
+26
-47
ManagerSpec.php
Spec/Core/Wire/Subscriptions/ManagerSpec.php
+7
-5
bootstrap.php
Spec/bootstrap.php
+18
-14
No files found.
Spec/Core/Boost/PaymentSpec.php
View file @
4ef022e1
This diff is collapsed.
Click to expand it.
Spec/Core/Wire/ManagerSpec.php
View file @
4ef022e1
...
...
@@ -17,81 +17,59 @@ use Prophecy\Argument;
class
ManagerSpec
extends
ObjectBehavior
{
protected
$cache
;
protected
$cache
Delegate
;
protected
$repo
;
protected
$subscriptionsManager
;
protected
$txManager
;
protected
$txRepo
;
protected
$config
;
protected
$queue
;
protected
$client
;
protected
$token
;
protected
$cap
;
protected
$dispatcher
;
protected
$call
;
protected
$balance
;
protected
$redisLock
;
protected
$plusDelegate
;
protected
$offchainTxs
;
public
function
let
(
Redis
$cache
,
Repository
$repo
,
SubscriptionsManager
$subscriptionsManager
,
BlockchainManager
$txManager
,
Core\Blockchain\Transactions\Repository
$txRepo
,
Config
$config
,
Client
$queue
,
Core\Blockchain\Services\Ethereum
$client
,
Core\Blockchain\Token
$token
,
Core\Blockchain\Wallets\OffChain\Cap
$cap
,
Core\Events\EventsDispatcher
$dispatcher
,
Core\Data\Call
$call
,
Core\Blockchain\Wallets\OffChain\Balance
$balance
,
Core\Data\Locks\Redis
$redisLock
,
Core\Wire\Delegates\Plus
$plusDelegate
,
Core\Blockchain\Wallets\OffChain\Transactions
$offchainTxs
Core\Wire\Delegates\RecurringDelegate
$recurringDelegate
,
Core\Wire\Delegates\NotificationDelegate
$notificationDelegate
,
Core\Wire\Delegates\CacheDelegate
$cacheDelegate
,
Core\Blockchain\Wallets\OffChain\Transactions
$offchainTxs
,
Core\Payments\Stripe\Intents\Manager
$stripeIntentsManager
)
{
$this
->
beConstructedWith
(
$cache
,
$repo
,
$subscriptionsManager
,
$txManager
,
$txRepo
,
$config
,
$queue
,
$client
,
$token
,
$cap
,
$dispatcher
,
$plusDelegate
,
$offchainTxs
);
Core\Di\Di
::
_
()
->
bind
(
'Database\Cassandra\Entities'
,
function
(
$di
)
use
(
$call
)
{
return
$call
->
getWrappedObject
();
});
Core\Di\Di
::
_
()
->
bind
(
'Database\Cassandra\UserIndexes'
,
function
(
$di
)
use
(
$call
)
{
return
$call
->
getWrappedObject
();
});
Core\Di\Di
::
_
()
->
bind
(
'Blockchain\Transactions\Repository'
,
function
(
$di
)
use
(
$txRepo
)
{
return
$txRepo
->
getWrappedObject
();
});
Core\Di\Di
::
_
()
->
bind
(
'Blockchain\Wallets\OffChain\Balance'
,
function
(
$di
)
use
(
$balance
)
{
return
$balance
->
getWrappedObject
();
});
Core\Di\Di
::
_
()
->
bind
(
'Database\Locks'
,
function
(
$di
)
use
(
$redisLock
)
{
return
$redisLock
->
getWrappedObject
();
});
$this
->
cache
=
$cache
;
$this
->
beConstructedWith
(
$repo
,
$txManager
,
$txRepo
,
$config
,
$client
,
$token
,
$cap
,
$plusDelegate
,
$recurringDelegate
,
$notificationDelegate
,
$cacheDelegate
,
$offchainTxs
,
$stripeIntentsManager
);
$this
->
cacheDelegate
=
$cacheDelegate
;
$this
->
repo
=
$repo
;
$this
->
subscriptionsManager
=
$subscriptionsManager
;
$this
->
txManager
=
$txManager
;
$this
->
txRepo
=
$txRepo
;
$this
->
config
=
$config
;
$this
->
queue
=
$queue
;
$this
->
client
=
$client
;
$this
->
token
=
$token
;
$this
->
cap
=
$cap
;
$this
->
dispatcher
=
$dispatcher
;
$this
->
call
=
$call
;
$this
->
balance
=
$balance
;
$this
->
redisLock
=
$redisLock
;
$this
->
plusDelegate
=
$plusDelegate
;
$this
->
offchainTxs
=
$offchainTxs
;
...
...
@@ -155,16 +133,17 @@ class ManagerSpec extends ObjectBehavior
->
shouldBeCalled
()
->
willReturn
(
true
);
$this
->
queue
->
setQueue
(
Argument
::
any
())
/*
$this->queue->setQueue(Argument::any())
->shouldBeCalled()
->willReturn($this->queue);
$this->queue->send(Argument::any())
->
shouldBeCalled
();
->shouldBeCalled();
*/
$receiver
=
new
User
();
$receiver
->
guid
=
123
;
$sender
=
new
User
();
$sender
->
guid
=
123
;
$wire
=
new
WireModel
();
$wire
->
setReceiver
(
$receiver
)
->
setSender
(
$sender
)
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Wire/Subscriptions/ManagerSpec.php
View file @
4ef022e1
...
...
@@ -3,7 +3,8 @@
namespace
Spec\Minds\Core\Wire\Subscriptions
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Payments\Subscriptions\Manager
;
use
Minds\Core\Wire\Manager
as
WireManager
;
use
Minds\Core\Payments\Subscriptions\Manager
as
SubscriptionsManager
;
use
Minds\Core\Payments\Subscriptions\Repository
;
use
Minds\Core\Wire\Exceptions\WalletNotSetupException
;
use
Minds\Entities\User
;
...
...
@@ -19,10 +20,11 @@ class ManagerSpec extends ObjectBehavior
}
function
it_should_create_a_subscription
(
Manager
$manager
WireManager
$wireManager
,
SubscriptionsManager
$subscriptionsManager
)
{
$this
->
beConstructedWith
(
$
m
anager
);
$this
->
beConstructedWith
(
$
wireManager
,
$subscriptionsM
anager
);
$sender
=
new
User
();
...
...
@@ -30,13 +32,13 @@ class ManagerSpec extends ObjectBehavior
$receiver
=
new
User
();
$receiver
->
guid
=
456
;
$
m
anager
->
setSubscription
(
Argument
::
that
(
function
(
$subscription
)
{
$
subscriptionsM
anager
->
setSubscription
(
Argument
::
that
(
function
(
$subscription
)
{
return
$subscription
->
getUser
()
->
guid
==
123
&&
$subscription
->
getEntity
()
->
guid
==
456
&&
$subscription
->
getAmount
()
==
5
;
}))
->
willReturn
(
123
);
$
m
anager
->
create
()
->
shouldBeCalled
();
$
subscriptionsM
anager
->
create
()
->
shouldBeCalled
();
$this
->
setAmount
(
5
)
->
setSender
(
$sender
)
...
...
This diff is collapsed.
Click to expand it.
Spec/bootstrap.php
View file @
4ef022e1
...
...
@@ -20,22 +20,26 @@ $CONFIG->cassandra->username = 'cassandra';
$CONFIG
->
cassandra
->
password
=
'cassandra'
;
$CONFIG
->
payments
=
[
'braintree'
=>
[
'default'
=>
[
'environment'
=>
'sandbox'
,
'merchant_id'
=>
'foobar'
,
'master_merchant_id'
=>
'foobar'
,
'public_key'
=>
'random'
,
'private_key'
=>
'random_private'
'braintree'
=>
[
'default'
=>
[
'environment'
=>
'sandbox'
,
'merchant_id'
=>
'foobar'
,
'master_merchant_id'
=>
'foobar'
,
'public_key'
=>
'random'
,
'private_key'
=>
'random_private'
],
'merchants'
=>
[
'environment'
=>
'sandbox'
,
'merchant_id'
=>
'foobar'
,
'master_merchant_id'
=>
'foobar'
,
'public_key'
=>
'random'
,
'private_key'
=>
'random_private'
],
],
'merchants'
=>
[
'environment'
=>
'sandbox'
,
'merchant_id'
=>
'foobar'
,
'master_merchant_id'
=>
'foobar'
,
'public_key'
=>
'random'
,
'private_key'
=>
'random_private'
'stripe'
=>
[
'api_key'
=>
'phpspec'
,
],
]
];
];
class
Mock
{
...
...
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