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
161
Issues
161
List
Boards
Labels
Service Desk
Milestones
Merge Requests
48
Merge Requests
48
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
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
6b58cdb9
Commit
6b58cdb9
authored
48 minutes ago
by
Emiliano Balbuena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(test): Fix spec tests
-subdomain=boost-campaigns
parent
27426906
goal/campaigns-1
No related merge requests found
Pipeline
#68539009
passed with stages
in 6 minutes and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
39 deletions
+19
-39
Boost.php
Core/Boost/Network/Boost.php
+10
-1
ElasticRepositorySpec.php
Spec/Core/Boost/Network/ElasticRepositorySpec.php
+9
-38
No files found.
Core/Boost/Network/Boost.php
View file @
6b58cdb9
...
...
@@ -15,7 +15,9 @@ use Minds\Traits\MagicAttributes;
* @method Boost setEntiyGuid()
* @method Boost setEntity()
* @method Entity getEntity()
* @method string getBid()
* @method Boost setBid()
* @method string getBidType()
* @method Boost setBidType()
* @method Booot setImpressions()
* @method int getImpressions()
...
...
@@ -23,13 +25,20 @@ use Minds\Traits\MagicAttributes;
* @method long getOwnerGuid()
* @method Boost setOwner()
* @method User getOwner()
*
* @method bool isPriority()
* @method int getRating()
* @method int getImpressionsMet()
* @method Boost setRejectedReason(int $reason)
* @method int getRejectedReason()
* @method int getCompletedTimestamp()
* @method Boost setCompletedTimestamp(int $ts)
* @method int getReviewedTimestamp()
* @method Boost setReviewedTimestamp(int $ts)
* @method int getRejectedTimestamp()
* @method Boost setRejectedTimestamp(int $ts)
* @method int getCreatedTimestamp()
* @method Boost setCreatedTimestamp(int $ts)
* @method int getRevokedTimestamp()
* @method Boost setRevokedTimestamp(int $ts)
* @method array getTags()
* @method Boost setTags(array $value)
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Boost/Network/ElasticRepositorySpec.php
View file @
6b58cdb9
...
...
@@ -4,18 +4,20 @@ namespace Spec\Minds\Core\Boost\Network;
use
Minds\Core\Boost\Network\ElasticRepository
;
use
Minds\Core\Boost\Network\Boost
;
use
Minds\Core\Boost\Raw\ElasticRepository
as
RawElasticRepository
;
use
Minds\Core\Boost\Raw\RawBoost
;
use
Minds\Core\Data\ElasticSearch\Client
as
Elastic
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
class
ElasticRepositorySpec
extends
ObjectBehavior
{
private
$
es
;
private
$
rawElasticRepository
;
function
let
(
Elastic
$es
)
function
let
(
RawElasticRepository
$rawElasticRepository
)
{
$this
->
beConstructedWith
(
$
es
);
$this
->
es
=
$es
;
$this
->
beConstructedWith
(
$
rawElasticRepository
);
$this
->
rawElasticRepository
=
$rawElasticRepository
;
}
function
it_is_initializable
()
...
...
@@ -23,42 +25,11 @@ class ElasticRepositorySpec extends ObjectBehavior
$this
->
shouldHaveType
(
ElasticRepository
::
class
);
}
function
it_should_add
()
function
it_should_add
(
Boost
$boost
)
{
$boost
=
(
new
Boost
())
->
setCreatedTimestamp
(
time
()
*
1000
)
->
setCompletedTimestamp
(
time
()
*
1000
)
->
setReviewedTimestamp
(
time
()
*
1000
)
->
setRevokedTimestamp
(
time
()
*
1000
)
->
setRejectedTimestamp
(
time
()
*
1000
)
->
setBid
(
10
*
(
10
**
18
))
->
setBidType
(
'tokens'
)
->
setEntityGuid
(
123
)
->
setImpressions
(
10000
)
->
setImpressionsMet
(
10
)
->
setOwnerGuid
(
456
)
->
setRating
(
1
)
->
setType
(
'newsfeed'
)
->
setPriority
(
false
);
// TODO: Improve test case prophecies
$this
->
es
->
request
(
Argument
::
that
(
function
(
$prepared
)
{
$body
=
$prepared
->
build
()[
'body'
];
return
round
(
$body
[
'doc'
][
'@timestamp'
],
-
5
)
===
round
(
time
()
*
1000
,
-
5
)
&&
round
(
$body
[
'doc'
][
'@completed'
],
-
5
)
===
round
(
time
()
*
1000
,
-
5
)
&&
round
(
$body
[
'doc'
][
'@reviewed'
],
-
5
)
===
round
(
time
()
*
1000
,
-
5
)
&&
round
(
$body
[
'doc'
][
'@revoked'
],
-
5
)
===
round
(
time
()
*
1000
,
-
5
)
&&
round
(
$body
[
'doc'
][
'@rejected'
],
-
5
)
===
round
(
time
()
*
1000
,
-
5
)
&&
$body
[
'doc'
][
'bid'
]
==
10
&&
$body
[
'doc'
][
'bid_type'
]
===
'tokens'
&&
$body
[
'doc'
][
'token_method'
]
===
'offchain'
&&
$body
[
'doc'
][
'entity_guid'
]
===
123
&&
$body
[
'doc'
][
'impressions'
]
===
10000
&&
$body
[
'doc'
][
'impressions_met'
]
===
10
&&
$body
[
'doc'
][
'owner_guid'
]
===
456
&&
$body
[
'doc'
][
'type'
]
===
'newsfeed'
&&
$body
[
'doc'
][
'priority'
]
===
false
;
}))
$this
->
rawElasticRepository
->
add
(
Argument
::
type
(
RawBoost
::
class
))
->
shouldBeCalled
()
->
willReturn
(
true
);
...
...
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