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
232
Issues
232
List
Boards
Labels
Service Desk
Milestones
Merge Requests
36
Merge Requests
36
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
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
89b949a3
Commit
89b949a3
authored
1 hour ago
by
Guy Thouret
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore) Add spec test for boost campaign metrics -
#631
parent
09b99a36
goal/boost-campaigns-e24
1 merge request
!235
WIP: Boost Campaigns (&24)
Pipeline
#86164494
passed with stages
in 9 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
Spec/Core/Boost/Campaigns/MetricsSpec.php
Spec/Core/Boost/Campaigns/MetricsSpec.php
+50
-0
No files found.
Spec/Core/Boost/Campaigns/MetricsSpec.php
View file @
89b949a3
...
...
@@ -2,14 +2,64 @@
namespace
Spec\Minds\Core\Boost\Campaigns
;
use
Minds\Common\Urn
;
use
Minds\Core\Boost\Campaigns\Campaign
;
use
Minds\Core\Boost\Campaigns\Metrics
;
use
Minds\Core\Counters\Manager
as
Counters
;
use
Minds\Core\Entities\Resolver
;
use
Minds\Entities\Activity
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
class
MetricsSpec
extends
ObjectBehavior
{
/** @var Counters */
protected
$counters
;
/** @var Resolver */
protected
$resolver
;
/** @var Campaign */
protected
$campaign
;
public
function
it_is_initializable
()
{
$this
->
shouldHaveType
(
Metrics
::
class
);
}
public
function
let
(
Counters
$counters
,
Resolver
$resolver
,
Campaign
$campaign
)
{
$this
->
beConstructedWith
(
$counters
,
$resolver
);
$this
->
setCampaign
(
$campaign
);
$this
->
counters
=
$counters
;
$this
->
resolver
=
$resolver
;
$this
->
campaign
=
$campaign
;
}
public
function
it_should_increment_counters
(
Activity
$activity
)
{
$this
->
counters
->
setEntityGuid
(
0
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
counters
->
setMetric
(
'boost_impressions'
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
counters
->
increment
()
->
shouldBeCalled
();
$this
->
campaign
->
getGuid
()
->
shouldBeCalled
()
->
willReturn
(
12345
);
$this
->
counters
->
setEntityGuid
(
12345
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
campaign
->
getEntityUrns
()
->
shouldBeCalled
()
->
willReturn
([
'urn:activity:12345'
]);
$this
->
resolver
->
single
(
Argument
::
type
(
Urn
::
class
))
->
shouldBeCalled
()
->
willReturn
(
$activity
);
$activity
->
get
(
'guid'
)
->
willReturn
(
'12345'
);
$activity
->
get
(
'owner_guid'
)
->
willReturn
(
'12345'
);
$this
->
counters
->
setMetric
(
'impression'
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
increment
();
}
public
function
it_should_get_impressions_met
()
{
$this
->
campaign
->
getGuid
()
->
shouldBeCalled
()
->
willReturn
(
12345
);
$this
->
counters
->
setEntityGuid
(
12345
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
counters
->
setMetric
(
'boost_impressions'
)
->
shouldBeCalled
()
->
willReturn
(
$this
->
counters
);
$this
->
counters
->
get
(
false
)
->
shouldBeCalled
()
->
willReturn
(
25
);
$this
->
getImpressionsMet
()
->
shouldReturn
(
25
);
}
}
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