Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
09dbaeb7
Commit
09dbaeb7
authored
Apr 23, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more assertions for cache test
parent
b0bf8f74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
CacheTest.php
tests/unit/framework/caching/CacheTest.php
+8
-8
No files found.
tests/unit/framework/caching/CacheTest.php
View file @
09dbaeb7
...
@@ -16,9 +16,9 @@ abstract class CacheTest extends TestCase
...
@@ -16,9 +16,9 @@ abstract class CacheTest extends TestCase
public
function
testSet
()
public
function
testSet
()
{
{
$cache
=
$this
->
getCacheInstance
();
$cache
=
$this
->
getCacheInstance
();
$
cache
->
set
(
'string_test'
,
'string_test'
);
$
this
->
assertTrue
(
$cache
->
set
(
'string_test'
,
'string_test'
)
);
$
cache
->
set
(
'number_test'
,
42
);
$
this
->
assertTrue
(
$cache
->
set
(
'number_test'
,
42
)
);
$
cache
->
set
(
'array_test'
,
array
(
'array_test'
=>
'array_test'
));
$
this
->
assertTrue
(
$cache
->
set
(
'array_test'
,
array
(
'array_test'
=>
'array_test'
)
));
$cache
[
'arrayaccess_test'
]
=
new
\stdClass
();
$cache
[
'arrayaccess_test'
]
=
new
\stdClass
();
}
}
...
@@ -45,7 +45,7 @@ abstract class CacheTest extends TestCase
...
@@ -45,7 +45,7 @@ abstract class CacheTest extends TestCase
public
function
testExpire
()
public
function
testExpire
()
{
{
$cache
=
$this
->
getCacheInstance
();
$cache
=
$this
->
getCacheInstance
();
$
cache
->
set
(
'expire_test'
,
'expire_test'
,
2
);
$
this
->
assertTrue
(
$cache
->
set
(
'expire_test'
,
'expire_test'
,
2
)
);
sleep
(
1
);
sleep
(
1
);
$this
->
assertEquals
(
'expire_test'
,
$cache
->
get
(
'expire_test'
));
$this
->
assertEquals
(
'expire_test'
,
$cache
->
get
(
'expire_test'
));
sleep
(
2
);
sleep
(
2
);
...
@@ -57,11 +57,11 @@ abstract class CacheTest extends TestCase
...
@@ -57,11 +57,11 @@ abstract class CacheTest extends TestCase
$cache
=
$this
->
getCacheInstance
();
$cache
=
$this
->
getCacheInstance
();
// should not change existing keys
// should not change existing keys
$
cache
->
add
(
'number_test'
,
13
);
$
this
->
assertFalse
(
$cache
->
add
(
'number_test'
,
13
)
);
$this
->
assertEquals
(
42
,
$cache
->
get
(
'number_test'
));
$this
->
assertEquals
(
42
,
$cache
->
get
(
'number_test'
));
// should store data is it's not there yet
// should store data is it's not there yet
$
cache
->
add
(
'add_test'
,
13
);
$
this
->
assertTrue
(
$cache
->
add
(
'add_test'
,
13
)
);
$this
->
assertEquals
(
13
,
$cache
->
get
(
'add_test'
));
$this
->
assertEquals
(
13
,
$cache
->
get
(
'add_test'
));
}
}
...
@@ -69,14 +69,14 @@ abstract class CacheTest extends TestCase
...
@@ -69,14 +69,14 @@ abstract class CacheTest extends TestCase
{
{
$cache
=
$this
->
getCacheInstance
();
$cache
=
$this
->
getCacheInstance
();
$
cache
->
delete
(
'number_test'
);
$
this
->
assertTrue
(
$cache
->
delete
(
'number_test'
)
);
$this
->
assertEquals
(
null
,
$cache
->
get
(
'number_test'
));
$this
->
assertEquals
(
null
,
$cache
->
get
(
'number_test'
));
}
}
public
function
testFlush
()
public
function
testFlush
()
{
{
$cache
=
$this
->
getCacheInstance
();
$cache
=
$this
->
getCacheInstance
();
$
cache
->
flush
(
);
$
this
->
assertTrue
(
$cache
->
flush
()
);
$this
->
assertEquals
(
null
,
$cache
->
get
(
'add_test'
));
$this
->
assertEquals
(
null
,
$cache
->
get
(
'add_test'
));
}
}
}
}
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