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
aa3d92f7
Commit
aa3d92f7
authored
Feb 25, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests for Vector
parent
79859238
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
VectorTest.php
tests/unit/framework/base/VectorTest.php
+23
-0
No files found.
tests/unit/framework/base/VectorTest.php
View file @
aa3d92f7
...
...
@@ -44,6 +44,16 @@ class VectorTest extends \yiiunit\TestCase
$this
->
assertEquals
(
2
,
$vector2
->
getCount
());
}
public
function
testItemAt
()
{
$a
=
array
(
1
,
2
,
null
,
4
);
$vector
=
new
Vector
(
$a
);
$this
->
assertEquals
(
1
,
$vector
->
itemAt
(
0
));
$this
->
assertEquals
(
2
,
$vector
->
itemAt
(
1
));
$this
->
assertNull
(
$vector
->
itemAt
(
2
));
$this
->
assertEquals
(
4
,
$vector
->
itemAt
(
3
));
}
public
function
testGetCount
()
{
$this
->
assertEquals
(
2
,
$this
->
vector
->
getCount
());
...
...
@@ -93,10 +103,17 @@ class VectorTest extends \yiiunit\TestCase
public
function
testClear
()
{
$this
->
vector
->
add
(
$this
->
item3
);
$this
->
vector
->
clear
();
$this
->
assertEquals
(
0
,
$this
->
vector
->
getCount
());
$this
->
assertEquals
(
-
1
,
$this
->
vector
->
indexOf
(
$this
->
item1
));
$this
->
assertEquals
(
-
1
,
$this
->
vector
->
indexOf
(
$this
->
item2
));
$this
->
vector
->
add
(
$this
->
item3
);
$this
->
vector
->
clear
(
true
);
$this
->
assertEquals
(
0
,
$this
->
vector
->
getCount
());
$this
->
assertEquals
(
-
1
,
$this
->
vector
->
indexOf
(
$this
->
item1
));
$this
->
assertEquals
(
-
1
,
$this
->
vector
->
indexOf
(
$this
->
item2
));
}
public
function
testContains
()
...
...
@@ -127,6 +144,12 @@ class VectorTest extends \yiiunit\TestCase
$array
=
array
(
$this
->
item3
,
$this
->
item1
);
$this
->
vector
->
mergeWith
(
$array
);
$this
->
assertTrue
(
$this
->
vector
->
getCount
()
==
4
&&
$this
->
vector
[
0
]
===
$this
->
item1
&&
$this
->
vector
[
3
]
===
$this
->
item1
);
$a
=
array
(
1
);
$vector
=
new
Vector
(
$a
);
$this
->
vector
->
mergeWith
(
$vector
);
$this
->
assertTrue
(
$this
->
vector
->
getCount
()
==
5
&&
$this
->
vector
[
0
]
===
$this
->
item1
&&
$this
->
vector
[
3
]
===
$this
->
item1
&&
$this
->
vector
[
4
]
===
1
);
$this
->
setExpectedException
(
'yii\base\InvalidCallException'
);
$this
->
vector
->
mergeWith
(
$this
);
}
...
...
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