Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
apc
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
apc
Commits
42bb7c66
Commit
42bb7c66
authored
5 months ago
by
Alberto Paderno
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3470060
: Improve the assert messages
parent
47fb1408
No related branches found
No related tags found
1 merge request
!77
Issue #3470060: Improve the assert messages
Pipeline
#268186
passed
5 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apc.test
+13
-23
13 additions, 23 deletions
apc.test
with
13 additions
and
23 deletions
apc.test
+
13
−
23
View file @
42bb7c66
...
...
@@ -119,27 +119,27 @@ trait ApcApcuTestTrait {
protected
function
storageData
()
{
// Return a multiple of 3 items.
// Avoid using NULL as value, since that fails tests.
yield
$this
->
randomName
()
=>
array
(
yield
'_01_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
$this
->
randomString
(),
'ttl'
=>
mt_rand
(
1
,
6
),
);
yield
$this
->
randomName
()
=>
array
(
yield
'_02_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
TRUE
,
'ttl'
=>
0
,
);
yield
$this
->
randomName
()
=>
array
(
yield
'_03_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
FALSE
,
'ttl'
=>
mt_rand
(
2
,
8
),
);
yield
$this
->
randomName
()
=>
array
(
yield
'_04_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
$this
->
randomFloat
(),
'ttl'
=>
0
,
);
yield
$this
->
randomName
()
=>
array
(
yield
'_05_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
$this
->
randomInt
(),
'ttl'
=>
mt_rand
(
2
,
8
),
);
yield
$this
->
randomName
()
=>
array
(
yield
'_06_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
array
(
$this
->
randomName
()
=>
$this
->
randomString
(),
$this
->
randomName
()
=>
$this
->
randomInt
(),
...
...
@@ -150,15 +150,15 @@ trait ApcApcuTestTrait {
),
'ttl'
=>
mt_rand
(
1
,
7
),
);
yield
$this
->
randomName
()
=>
array
(
yield
'_07_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
$this
->
randomString
(),
'ttl'
=>
mt_rand
(
1
,
8
),
);
yield
$this
->
randomName
()
=>
array
(
yield
'_08_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
FALSE
,
'ttl'
=>
0
,
);
yield
$this
->
randomName
()
=>
array
(
yield
'_09_'
.
$this
->
randomName
()
=>
array
(
'value'
=>
$this
->
randomFloat
(),
'ttl'
=>
mt_rand
(
2
,
6
),
);
...
...
@@ -212,10 +212,7 @@ trait ApcApcuTestTrait {
* TRUE if the key-value pair was stored, FALSE otherwise.
*/
protected
function
assertApcuKeySaved
(
$key
,
$value
,
$ttl
=
0
)
{
$message
=
format_string
(
'@key (@value) was stored in APCu.'
,
array
(
'@key'
=>
$this
->
varExport
(
$key
),
'@value'
=>
$this
->
varExport
(
$value
))
);
$message
=
format_string
(
'@key was stored in APCu.'
,
array
(
'@key'
=>
$this
->
varExport
(
$key
)));
$result
=
apcu_store
(
$key
,
$value
,
$ttl
);
...
...
@@ -250,10 +247,7 @@ trait ApcApcuTestTrait {
if
(
$this
->
assertTrue
(
apcu_exists
(
$key
),
$message
))
{
if
(
array_key_exists
(
'value'
,
$options
))
{
$message
=
format_string
(
'The value for @key (@value) is the expected one.'
,
array
(
'@key'
=>
$this
->
varExport
(
$key
),
'@value'
=>
$this
->
varExport
(
$options
[
'value'
]))
);
$message
=
format_string
(
'The value for @key is the expected one.'
,
array
(
'@key'
=>
$this
->
varExport
(
$key
)));
$retrieved
=
apcu_fetch
(
$key
,
$success
);
...
...
@@ -583,12 +577,8 @@ trait ApcCacheTestTrait {
if
(
$this
->
assertTrue
(
is_object
(
$item
)
&&
isset
(
$item
->
data
),
$message
))
{
if
(
array_key_exists
(
'value'
,
$options
))
{
$value
=
$options
[
'value'
];
$args
=
array
(
'@id'
=>
$this
->
varExport
(
"
$bin
/
$cid
"
),
'@value'
=>
$this
->
varExport
(
$value
),
'@retrieved'
=>
$this
->
varExport
(
$item
->
data
),
);
$message
=
format_string
(
'The value of @id (@retrieved) is the expected one (@value).'
,
$args
);
$args
=
array
(
'@id'
=>
$this
->
varExport
(
"
$bin
/
$cid
"
));
$message
=
format_string
(
'The value of @id is the expected one.'
,
$args
);
return
$this
->
assertIdentical
(
$item
->
data
,
$value
,
$message
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment