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
f9832ac2
Commit
f9832ac2
authored
2 hours ago
by
Marcelo Rivera
Browse files
Options
Download
(fix): spec tests and lint
parent
b03f0147
feat/copy-entity-for-jury
1 merge request
!467
When an entity gets reported, save a copy that can't be edited
Pipeline
#117968029
failed with stages
in 62 minutes and 51 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
Core/Reports/Appeals/Repository.php
View file @
f9832ac2
<?php
namespace
Minds\Core\Reports\Appeals
;
use
Cassandra
;
use
Cassandra\Bigint
;
use
Cassandra\Tinyint
;
use
Cassandra\Decimal
;
use
Cassandra\Type
;
use
Cassandra\Map
;
use
Cassandra\Timestamp
;
use
Minds\Core
;
use
Minds\Core\Di\Di
;
use
Cassandra\Tinyint
;
use
Cassandra\Type
;
use
Minds\Common\Repository\Response
;
use
Minds\Core\Data
;
use
Minds\Core\Data\Cassandra\Prepared\Custom
as
Prepared
;
use
Minds\Entities
;
use
Minds\Entities\DenormalizedEntity
;
use
Minds\Entities\NormalizedEntity
;
use
Minds\Common\Repository\Response
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Reports\Repository
as
ReportsRepository
;
class
Repository
...
...
This diff is collapsed.
Core/Reports/Repository.php
View file @
f9832ac2
...
...
@@ -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 @
f9832ac2
...
...
@@ -26,7 +26,7 @@ class RepositorySpec extends ObjectBehavior
{
$this
->
beConstructedWith
(
$cql
);
$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 @
f9832ac2
...
...
@@ -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