Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
277
Merge Requests
35
CI / CD
Security & Compliance
Packages
Analytics
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
32d6fdec
Commit
32d6fdec
authored
2 hours ago
by
Marcelo Rivera
Browse files
Options
Download
(fix): spec tests and lint
parent
b03f0147
No related merge requests found
Pipeline
#117960018
failed with stages
in 2 minutes and 45 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
18 deletions
+23
-18
Core/Reports/Repository.php
View file @
32d6fdec
...
...
@@ -255,7 +255,7 @@ class Repository
isset
(
$row
[
'user_hashes'
])
?
$row
[
'user_hashes'
]
->
values
()
:
null
)
->
setOriginalEntity
(
$row
[
'original_entity'
]
?
$this
->
buildFromJson
(
$row
[
'original_entity'
])
:
null
);
->
setOriginalEntity
(
isset
(
$row
[
'original_entity'
])
?
$this
->
buildFromJson
(
$row
[
'original_entity'
])
:
null
);
return
$report
;
}
...
...
@@ -277,8 +277,9 @@ class Repository
private
function
isJson
(
$string
)
{
if
(
!
is_string
(
$string
))
if
(
!
is_string
(
$string
))
{
return
false
;
}
json_decode
(
$string
);
return
(
json_last_error
()
==
JSON_ERROR_NONE
);
...
...
This diff is collapsed.
Spec/Core/Reports/Appeals/RepositorySpec.php
View file @
32d6fdec
...
...
@@ -24,9 +24,9 @@ class RepositorySpec extends ObjectBehavior
public
function
let
(
Client
$cql
,
ReportsRepository
$reportsRepository
)
{
$this
->
beConstructedWith
(
$cql
);
$this
->
beConstructedWith
(
$cql
,
$reportsRepository
);
$this
->
cql
=
$cql
;
//
$this->reportsRepository = $reportsRepository;
$this
->
reportsRepository
=
$reportsRepository
;
}
public
function
it_is_initializable
()
...
...
@@ -149,11 +149,11 @@ class RepositorySpec extends ObjectBehavior
$appeal
->
getReport
()
->
shouldBeCalled
()
->
willReturn
(
$report
);
$appeal
->
getNote
()
->
shouldBeCalled
()
->
willReturn
(
'Should not be reported because this is a test'
);
$this
->
add
(
$appeal
)
->
shouldBe
(
true
);
}
...
...
This diff is collapsed.
Spec/Core/Reports/UserReports/RepositorySpec.php
View file @
32d6fdec
...
...
@@ -6,6 +6,7 @@ use Minds\Core\Reports\UserReports\Repository;
use
Minds\Core\Reports\UserReports\UserReport
;
use
Minds\Core\Reports\Report
;
use
Minds\Core\Data\Cassandra\Client
;
use
Minds\Entities\Activity
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
...
...
@@ -24,7 +25,7 @@ class RepositorySpec extends ObjectBehavior
$this
->
shouldHaveType
(
Repository
::
class
);
}
public
function
it_should_add_a_report
(
UserReport
$userReport
)
public
function
it_should_add_a_report
(
UserReport
$userReport
,
Activity
$activity
)
{
$ts
=
(
int
)
microtime
(
true
);
$this
->
cql
->
request
(
Argument
::
that
(
function
(
$prepared
)
use
(
$ts
)
{
...
...
@@ -32,11 +33,12 @@ class RepositorySpec extends ObjectBehavior
$values
=
$query
[
'values'
];
return
$values
[
0
]
->
values
()[
0
]
->
value
()
==
456
&&
$values
[
2
]
->
values
()[
0
]
->
value
()
==
'hash'
&&
$values
[
3
]
===
'urn:activity:123'
&&
$values
[
4
]
->
value
()
==
2
&&
$values
[
5
]
->
value
()
==
4
&&
$values
[
6
]
->
time
()
==
$ts
;
&&
$values
[
2
]
==
"{}"
&&
$values
[
3
]
->
values
()[
0
]
==
'hash'
&&
$values
[
4
]
===
'urn:activity:123'
&&
$values
[
5
]
->
value
()
==
2
&&
$values
[
6
]
->
value
()
==
4
&&
$values
[
7
]
->
time
()
==
$ts
;
}))
->
shouldBeCalled
()
->
willReturn
(
true
);
...
...
@@ -45,16 +47,18 @@ class RepositorySpec extends ObjectBehavior
->
shouldBeCalled
()
->
willReturn
(
(
new
Report
)
->
setEntityUrn
(
"urn:activity:123"
)
->
setTimestamp
(
$ts
)
->
setReasonCode
(
2
)
->
setSubReasonCode
(
4
)
->
setEntityUrn
(
"urn:activity:123"
)
->
setEntity
(
$activity
)
->
setEntityOwnerGuid
(
1
)
->
setTimestamp
(
$ts
)
->
setReasonCode
(
2
)
->
setSubReasonCode
(
4
)
);
$userReport
->
getReporterGuid
()
->
shouldBeCalled
()
->
willReturn
(
456
);
$userReport
->
getReporterHash
()
->
shouldBeCalled
()
->
willReturn
(
'hash'
);
...
...
This diff is collapsed.
Please
register
or
sign in
to comment