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
f68bed0c
Commit
f68bed0c
authored
Mar 03, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed exception.
parent
e6672984
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
100 deletions
+93
-100
Dictionary.php
framework/base/Dictionary.php
+4
-4
Vector.php
framework/base/Vector.php
+10
-10
View.php
framework/base/View.php
+2
-2
ActiveRecord.php
framework/db/ActiveRecord.php
+3
-2
TableSchema.php
framework/db/TableSchema.php
+3
-3
QueryBuilder.php
framework/db/mysql/QueryBuilder.php
+4
-4
QueryBuilder.php
framework/db/sqlite/QueryBuilder.php
+4
-4
ArrayHelper.php
framework/util/ArrayHelper.php
+4
-4
VarDumper.php
framework/util/VarDumper.php
+52
-60
DictionaryTest.php
tests/unit/framework/base/DictionaryTest.php
+2
-2
VectorTest.php
tests/unit/framework/base/VectorTest.php
+5
-5
No files found.
framework/base/Dictionary.php
View file @
f68bed0c
...
...
@@ -184,7 +184,7 @@ class Dictionary extends Object implements \IteratorAggregate, \ArrayAccess, \Co
* Copies iterable data into the dictionary.
* Note, existing data in the dictionary will be cleared first.
* @param mixed $data the data to be copied from, must be an array or an object implementing `Traversable`
* @throws Invalid
Call
Exception if data is neither an array nor an iterator.
* @throws Invalid
Param
Exception if data is neither an array nor an iterator.
*/
public
function
copyFrom
(
$data
)
{
...
...
@@ -199,7 +199,7 @@ class Dictionary extends Object implements \IteratorAggregate, \ArrayAccess, \Co
$this
->
add
(
$key
,
$value
);
}
}
else
{
throw
new
Invalid
Call
Exception
(
'Data must be either an array or an object implementing Traversable.'
);
throw
new
Invalid
Param
Exception
(
'Data must be either an array or an object implementing Traversable.'
);
}
}
...
...
@@ -216,7 +216,7 @@ class Dictionary extends Object implements \IteratorAggregate, \ArrayAccess, \Co
*
* @param array|\Traversable $data the data to be merged with. It must be an array or object implementing Traversable
* @param boolean $recursive whether the merging should be recursive.
* @throws Invalid
Call
Exception if data is neither an array nor an object implementing `Traversable`.
* @throws Invalid
Param
Exception if data is neither an array nor an object implementing `Traversable`.
*/
public
function
mergeWith
(
$data
,
$recursive
=
true
)
{
...
...
@@ -240,7 +240,7 @@ class Dictionary extends Object implements \IteratorAggregate, \ArrayAccess, \Co
}
}
}
else
{
throw
new
Invalid
Call
Exception
(
'The data to be merged with must be an array or an object implementing Traversable.'
);
throw
new
Invalid
Param
Exception
(
'The data to be merged with must be an array or an object implementing Traversable.'
);
}
}
...
...
framework/base/Vector.php
View file @
f68bed0c
...
...
@@ -101,7 +101,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* Returns the item at the specified index.
* @param integer $index the index of the item
* @return mixed the item at the index
* @throws Invalid
Call
Exception if the index is out of range
* @throws Invalid
Param
Exception if the index is out of range
*/
public
function
itemAt
(
$index
)
{
...
...
@@ -110,7 +110,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
}
elseif
(
$index
>=
0
&&
$index
<
$this
->
_c
)
{
// in case the value is null
return
$this
->
_d
[
$index
];
}
else
{
throw
new
Invalid
Call
Exception
(
'Index out of range: '
.
$index
);
throw
new
Invalid
Param
Exception
(
'Index out of range: '
.
$index
);
}
}
...
...
@@ -132,7 +132,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* one step towards the end.
* @param integer $index the specified position.
* @param mixed $item new item to be inserted into the vector
* @throws Invalid
Call
Exception if the index specified is out of range, or the vector is read-only.
* @throws Invalid
Param
Exception if the index specified is out of range, or the vector is read-only.
*/
public
function
insertAt
(
$index
,
$item
)
{
...
...
@@ -142,7 +142,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
array_splice
(
$this
->
_d
,
$index
,
0
,
array
(
$item
));
$this
->
_c
++
;
}
else
{
throw
new
Invalid
Call
Exception
(
'Index out of range: '
.
$index
);
throw
new
Invalid
Param
Exception
(
'Index out of range: '
.
$index
);
}
}
...
...
@@ -169,7 +169,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* Removes an item at the specified position.
* @param integer $index the index of the item to be removed.
* @return mixed the removed item.
* @throws Invalid
Call
Exception if the index is out of range, or the vector is read only.
* @throws Invalid
Param
Exception if the index is out of range, or the vector is read only.
*/
public
function
removeAt
(
$index
)
{
...
...
@@ -183,7 +183,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
return
$item
;
}
}
else
{
throw
new
Invalid
Call
Exception
(
'Index out of range: '
.
$index
);
throw
new
Invalid
Param
Exception
(
'Index out of range: '
.
$index
);
}
}
...
...
@@ -242,7 +242,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* Copies iterable data into the vector.
* Note, existing data in the vector will be cleared first.
* @param mixed $data the data to be copied from, must be an array or an object implementing `Traversable`
* @throws Invalid
Call
Exception if data is neither an array nor an object implementing `Traversable`.
* @throws Invalid
Param
Exception if data is neither an array nor an object implementing `Traversable`.
*/
public
function
copyFrom
(
$data
)
{
...
...
@@ -257,7 +257,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
$this
->
add
(
$item
);
}
}
else
{
throw
new
Invalid
Call
Exception
(
'Data must be either an array or an object implementing Traversable.'
);
throw
new
Invalid
Param
Exception
(
'Data must be either an array or an object implementing Traversable.'
);
}
}
...
...
@@ -265,7 +265,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* Merges iterable data into the vector.
* New items will be appended to the end of the existing items.
* @param array|\Traversable $data the data to be merged with. It must be an array or object implementing Traversable
* @throws Invalid
Call
Exception if data is neither an array nor an object implementing `Traversable`.
* @throws Invalid
Param
Exception if data is neither an array nor an object implementing `Traversable`.
*/
public
function
mergeWith
(
$data
)
{
...
...
@@ -277,7 +277,7 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
$this
->
add
(
$item
);
}
}
else
{
throw
new
Invalid
Call
Exception
(
'The data to be merged with must be an array or an object implementing Traversable.'
);
throw
new
Invalid
Param
Exception
(
'The data to be merged with must be an array or an object implementing Traversable.'
);
}
}
...
...
framework/base/View.php
View file @
f68bed0c
...
...
@@ -122,7 +122,7 @@ class View extends Component
* @param array $params the parameters that should be made available in the view. The PHP function `extract()`
* will be called on this variable to extract the variables from this parameter.
* @return string the rendering result
* @throws Invalid
Call
Exception if the view file cannot be found
* @throws Invalid
Param
Exception if the view file cannot be found
* @see findViewFile()
*/
public
function
renderPartial
(
$view
,
$params
=
array
())
...
...
@@ -131,7 +131,7 @@ class View extends Component
if
(
$file
!==
false
)
{
return
$this
->
renderFile
(
$file
,
$params
);
}
else
{
throw
new
Invalid
Call
Exception
(
"Unable to find the view file for view '
$view
'."
);
throw
new
Invalid
Param
Exception
(
"Unable to find the view file for view '
$view
'."
);
}
}
...
...
framework/db/ActiveRecord.php
View file @
f68bed0c
...
...
@@ -11,6 +11,7 @@
namespace
yii\db
;
use
yii\base\Model
;
use
yii\base\InvalidParamException
;
use
yii\base\Event
;
use
yii\base\ModelEvent
;
use
yii\base\UnknownMethodException
;
...
...
@@ -1045,7 +1046,7 @@ class ActiveRecord extends Model
* It can be declared in either the Active Record class itself or one of its behaviors.
* @param string $name the relation name
* @return ActiveRelation the relation object
* @throws Invalid
Call
Exception if the named relation does not exist.
* @throws Invalid
Param
Exception if the named relation does not exist.
*/
public
function
getRelation
(
$name
)
{
...
...
@@ -1057,7 +1058,7 @@ class ActiveRecord extends Model
}
}
catch
(
UnknownMethodException
$e
)
{
}
throw
new
Invalid
Call
Exception
(
get_class
(
$this
)
.
' has no relation named "'
.
$name
.
'".'
);
throw
new
Invalid
Param
Exception
(
get_class
(
$this
)
.
' has no relation named "'
.
$name
.
'".'
);
}
/**
...
...
framework/db/TableSchema.php
View file @
f68bed0c
...
...
@@ -9,7 +9,7 @@
namespace
yii\db
;
use
yii\base\Invalid
Call
Exception
;
use
yii\base\Invalid
Param
Exception
;
/**
* TableSchema represents the metadata of a database table.
...
...
@@ -83,7 +83,7 @@ class TableSchema extends \yii\base\Object
/**
* Manually specifies the primary key for this table.
* @param string|array $keys the primary key (can be composite)
* @throws Invalid
Call
Exception if the specified key cannot be found in the table.
* @throws Invalid
Param
Exception if the specified key cannot be found in the table.
*/
public
function
fixPrimaryKey
(
$keys
)
{
...
...
@@ -98,7 +98,7 @@ class TableSchema extends \yii\base\Object
if
(
isset
(
$this
->
columns
[
$key
]))
{
$this
->
columns
[
$key
]
->
isPrimaryKey
=
true
;
}
else
{
throw
new
Invalid
Call
Exception
(
"Primary key '
$key
' cannot be found in table '
{
$this
->
name
}
'."
);
throw
new
Invalid
Param
Exception
(
"Primary key '
$key
' cannot be found in table '
{
$this
->
name
}
'."
);
}
}
}
...
...
framework/db/mysql/QueryBuilder.php
View file @
f68bed0c
...
...
@@ -10,7 +10,7 @@
namespace
yii\db\mysql
;
use
yii\db\Exception
;
use
yii\base\Invalid
Call
Exception
;
use
yii\base\Invalid
Param
Exception
;
/**
* QueryBuilder is the query builder for MySQL databases.
...
...
@@ -98,7 +98,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
* @return string the SQL statement for resetting sequence
* @throws Invalid
Call
Exception if the table does not exist or there is no sequence associated with the table.
* @throws Invalid
Param
Exception if the table does not exist or there is no sequence associated with the table.
*/
public
function
resetSequence
(
$tableName
,
$value
=
null
)
{
...
...
@@ -113,9 +113,9 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
return
"ALTER TABLE
$tableName
AUTO_INCREMENT=
$value
"
;
}
elseif
(
$table
===
null
)
{
throw
new
Invalid
Call
Exception
(
"Table not found:
$tableName
"
);
throw
new
Invalid
Param
Exception
(
"Table not found:
$tableName
"
);
}
else
{
throw
new
Invalid
Call
Exception
(
"There is not sequence associated with table '
$tableName
'.'"
);
throw
new
Invalid
Param
Exception
(
"There is not sequence associated with table '
$tableName
'.'"
);
}
}
...
...
framework/db/sqlite/QueryBuilder.php
View file @
f68bed0c
...
...
@@ -10,8 +10,8 @@
namespace
yii\db\sqlite
;
use
yii\db\Exception
;
use
yii\base\InvalidParamException
;
use
yii\base\NotSupportedException
;
use
yii\base\InvalidCallException
;
/**
* QueryBuilder is the query builder for SQLite databases.
...
...
@@ -50,7 +50,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
* @return string the SQL statement for resetting sequence
* @throws Invalid
Call
Exception if the table does not exist or there is no sequence associated with the table.
* @throws Invalid
Param
Exception if the table does not exist or there is no sequence associated with the table.
*/
public
function
resetSequence
(
$tableName
,
$value
=
null
)
{
...
...
@@ -70,9 +70,9 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
catch
(
Exception
$e
)
{
}
}
elseif
(
$table
===
null
)
{
throw
new
Invalid
Call
Exception
(
"Table not found:
$tableName
"
);
throw
new
Invalid
Param
Exception
(
"Table not found:
$tableName
"
);
}
else
{
throw
new
Invalid
Call
Exception
(
"There is not sequence associated with table '
$tableName
'.'"
);
throw
new
Invalid
Param
Exception
(
"There is not sequence associated with table '
$tableName
'.'"
);
}
}
...
...
framework/util/ArrayHelper.php
View file @
f68bed0c
...
...
@@ -9,7 +9,7 @@
namespace
yii\util
;
use
yii\base\Invalid
Call
Exception
;
use
yii\base\Invalid
Param
Exception
;
/**
* ArrayHelper provides additional array functionality you can use in your
...
...
@@ -242,7 +242,7 @@ class ArrayHelper
* value is for sorting strings in case-insensitive manner. Please refer to
* See [PHP manual](http://php.net/manual/en/function.sort.php) for more details.
* When sorting by multiple keys with different sort flags, use an array of sort flags.
* @throws Invalid
Call
Exception if the $ascending or $sortFlag parameters do not have
* @throws Invalid
Param
Exception if the $ascending or $sortFlag parameters do not have
* correct number of elements as that of $key.
*/
public
static
function
multisort
(
&
$array
,
$key
,
$ascending
=
true
,
$sortFlag
=
SORT_REGULAR
)
...
...
@@ -255,12 +255,12 @@ class ArrayHelper
if
(
is_scalar
(
$ascending
))
{
$ascending
=
array_fill
(
0
,
$n
,
$ascending
);
}
elseif
(
count
(
$ascending
)
!==
$n
)
{
throw
new
Invalid
Call
Exception
(
'The length of $ascending parameter must be the same as that of $keys.'
);
throw
new
Invalid
Param
Exception
(
'The length of $ascending parameter must be the same as that of $keys.'
);
}
if
(
is_scalar
(
$sortFlag
))
{
$sortFlag
=
array_fill
(
0
,
$n
,
$sortFlag
);
}
elseif
(
count
(
$sortFlag
)
!==
$n
)
{
throw
new
Invalid
Call
Exception
(
'The length of $ascending parameter must be the same as that of $keys.'
);
throw
new
Invalid
Param
Exception
(
'The length of $ascending parameter must be the same as that of $keys.'
);
}
$args
=
array
();
foreach
(
$keys
as
$i
=>
$key
)
{
...
...
framework/util/VarDumper.php
View file @
f68bed0c
...
...
@@ -17,14 +17,15 @@ namespace yii\util;
* recursive display of some peculiar variables.
*
* VarDumper can be used as follows,
* <pre>
*
* ~~~
* VarDumper::dump($var);
*
</pre>
*
~~~
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
VarDumper
class
C
VarDumper
{
private
static
$_objects
;
private
static
$_output
;
...
...
@@ -38,9 +39,9 @@ class VarDumper
* @param integer $depth maximum depth that the dumper should go into the variable. Defaults to 10.
* @param boolean $highlight whether the result should be syntax-highlighted
*/
public
static
function
dump
(
$var
,
$depth
=
10
,
$highlight
=
false
)
public
static
function
dump
(
$var
,
$depth
=
10
,
$highlight
=
false
)
{
echo
self
::
dumpAsString
(
$var
,
$depth
,
$highlight
);
echo
self
::
dumpAsString
(
$var
,
$depth
,
$highlight
);
}
/**
...
...
@@ -52,16 +53,15 @@ class VarDumper
* @param boolean $highlight whether the result should be syntax-highlighted
* @return string the string representation of the variable
*/
public
static
function
dumpAsString
(
$var
,
$depth
=
10
,
$highlight
=
false
)
public
static
function
dumpAsString
(
$var
,
$depth
=
10
,
$highlight
=
false
)
{
self
::
$_output
=
''
;
self
::
$_objects
=
array
();
self
::
$_depth
=
$depth
;
self
::
dumpInternal
(
$var
,
0
);
if
(
$highlight
)
{
$result
=
highlight_string
(
"<?php
\n
"
.
self
::
$_output
,
true
);
self
::
$_output
=
preg_replace
(
'/<\\?php<br \\/>/'
,
''
,
$result
,
1
);
self
::
$_output
=
''
;
self
::
$_objects
=
array
();
self
::
$_depth
=
$depth
;
self
::
dumpInternal
(
$var
,
0
);
if
(
$highlight
)
{
$result
=
highlight_string
(
"<?php
\n
"
.
self
::
$_output
,
true
);
self
::
$_output
=
preg_replace
(
'/<\\?php<br \\/>/'
,
''
,
$result
,
1
);
}
return
self
::
$_output
;
}
...
...
@@ -70,73 +70,65 @@ class VarDumper
* @param mixed $var variable to be dumped
* @param integer $level depth level
*/
private
static
function
dumpInternal
(
$var
,
$level
)
private
static
function
dumpInternal
(
$var
,
$level
)
{
switch
(
gettype
(
$var
))
{
switch
(
gettype
(
$var
))
{
case
'boolean'
:
self
::
$_output
.=
$var
?
'true'
:
'false'
;
self
::
$_output
.=
$var
?
'true'
:
'false'
;
break
;
case
'integer'
:
self
::
$_output
.=
"
$var
"
;
self
::
$_output
.=
"
$var
"
;
break
;
case
'double'
:
self
::
$_output
.=
"
$var
"
;
self
::
$_output
.=
"
$var
"
;
break
;
case
'string'
:
self
::
$_output
.=
"'"
.
addslashes
(
$var
)
.
"'"
;
self
::
$_output
.=
"'"
.
addslashes
(
$var
)
.
"'"
;
break
;
case
'resource'
:
self
::
$_output
.=
'{resource}'
;
self
::
$_output
.=
'{resource}'
;
break
;
case
'NULL'
:
self
::
$_output
.=
"null"
;
self
::
$_output
.=
"null"
;
break
;
case
'unknown type'
:
self
::
$_output
.=
'{unknown}'
;
self
::
$_output
.=
'{unknown}'
;
break
;
case
'array'
:
if
(
self
::
$_depth
<=
$level
)
self
::
$_output
.=
'array(...)'
;
else
if
(
empty
(
$var
))
self
::
$_output
.=
'array()'
;
else
{
$keys
=
array_keys
(
$var
);
$spaces
=
str_repeat
(
' '
,
$level
*
4
);
self
::
$_output
.=
"array
\n
"
.
$spaces
.
'('
;
foreach
(
$keys
as
$key
)
{
if
(
gettype
(
$key
)
==
'integer'
)
$key2
=
$key
;
else
$key2
=
"'"
.
str_replace
(
"'"
,
"
\\
'"
,
$key
)
.
"'"
;
self
::
$_output
.=
"
\n
"
.
$spaces
.
"
$key2
=> "
;
self
::
$_output
.=
self
::
dumpInternal
(
$var
[
$key
],
$level
+
1
);
if
(
self
::
$_depth
<=
$level
)
{
self
::
$_output
.=
'array(...)'
;
}
elseif
(
empty
(
$var
))
{
self
::
$_output
.=
'array()'
;
}
else
{
$keys
=
array_keys
(
$var
);
$spaces
=
str_repeat
(
' '
,
$level
*
4
);
self
::
$_output
.=
"array
\n
"
.
$spaces
.
'('
;
foreach
(
$keys
as
$key
)
{
self
::
$_output
.=
"
\n
"
.
$spaces
.
' '
;
self
::
dumpInternal
(
$key
,
0
);
self
::
$_output
.=
' => '
;
self
::
dumpInternal
(
$var
[
$key
],
$level
+
1
);
}
self
::
$_output
.=
"
\n
"
.
$spaces
.
')'
;
self
::
$_output
.=
"
\n
"
.
$spaces
.
')'
;
}
break
;
case
'object'
:
if
((
$id
=
array_search
(
$var
,
self
::
$_objects
,
true
))
!==
false
)
self
::
$_output
.=
get_class
(
$var
)
.
'#'
.
(
$id
+
1
)
.
'(...)'
;
else
if
(
self
::
$_depth
<=
$level
)
self
::
$_output
.=
get_class
(
$var
)
.
'(...)'
;
else
{
$id
=
array_push
(
self
::
$_objects
,
$var
);
$className
=
get_class
(
$var
);
$members
=
(
array
)
$var
;
$spaces
=
str_repeat
(
' '
,
$level
*
4
);
self
::
$_output
.=
"
$className
#
$id
\n
"
.
$spaces
.
'('
;
foreach
(
$members
as
$key
=>
$value
)
{
$keyDisplay
=
strtr
(
trim
(
$key
),
array
(
"
\0
"
=>
':'
));
self
::
$_output
.=
"
\n
"
.
$spaces
.
" [
$keyDisplay
] => "
;
self
::
$_output
.=
self
::
dumpInternal
(
$value
,
$level
+
1
);
if
((
$id
=
array_search
(
$var
,
self
::
$_objects
,
true
))
!==
false
)
{
self
::
$_output
.=
get_class
(
$var
)
.
'#'
.
(
$id
+
1
)
.
'(...)'
;
}
elseif
(
self
::
$_depth
<=
$level
)
{
self
::
$_output
.=
get_class
(
$var
)
.
'(...)'
;
}
else
{
$id
=
self
::
$_objects
[]
=
$var
;
$className
=
get_class
(
$var
);
$members
=
(
array
)
$var
;
$spaces
=
str_repeat
(
' '
,
$level
*
4
);
self
::
$_output
.=
"
$className
#
$id
\n
"
.
$spaces
.
'('
;
foreach
(
$members
as
$key
=>
$value
)
{
$keyDisplay
=
strtr
(
trim
(
$key
),
array
(
"
\0
"
=>
':'
));
self
::
$_output
.=
"
\n
"
.
$spaces
.
" [
$keyDisplay
] => "
;
self
::
dumpInternal
(
$value
,
$level
+
1
);
}
self
::
$_output
.=
"
\n
"
.
$spaces
.
')'
;
self
::
$_output
.=
"
\n
"
.
$spaces
.
')'
;
}
break
;
}
...
...
tests/unit/framework/base/DictionaryTest.php
View file @
f68bed0c
...
...
@@ -103,7 +103,7 @@ class DictionaryTest extends \yiiunit\TestCase
$this
->
assertEquals
(
$this
->
item3
,
$this
->
dictionary
[
'key3'
]);
$this
->
assertEquals
(
$this
->
item1
,
$this
->
dictionary
[
'key4'
]);
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
dictionary
->
copyFrom
(
$this
);
}
...
...
@@ -122,7 +122,7 @@ class DictionaryTest extends \yiiunit\TestCase
$this
->
assertEquals
(
3
,
$this
->
dictionary
->
getCount
());
$this
->
assertEquals
(
$this
->
item1
,
$this
->
dictionary
[
'key2'
]);
$this
->
assertEquals
(
$this
->
item3
,
$this
->
dictionary
[
'key3'
]);
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
dictionary
->
mergeWith
(
$this
,
false
);
}
...
...
tests/unit/framework/base/VectorTest.php
View file @
f68bed0c
...
...
@@ -75,7 +75,7 @@ class VectorTest extends \yiiunit\TestCase
$this
->
assertEquals
(
2
,
$this
->
vector
->
indexOf
(
$this
->
item2
));
$this
->
assertEquals
(
0
,
$this
->
vector
->
indexOf
(
$this
->
item3
));
$this
->
assertEquals
(
1
,
$this
->
vector
->
indexOf
(
$this
->
item1
));
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
vector
->
insertAt
(
4
,
$this
->
item3
);
}
...
...
@@ -97,7 +97,7 @@ class VectorTest extends \yiiunit\TestCase
$this
->
assertEquals
(
-
1
,
$this
->
vector
->
indexOf
(
$this
->
item2
));
$this
->
assertEquals
(
1
,
$this
->
vector
->
indexOf
(
$this
->
item3
));
$this
->
assertEquals
(
0
,
$this
->
vector
->
indexOf
(
$this
->
item1
));
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
vector
->
removeAt
(
2
);
}
...
...
@@ -135,7 +135,7 @@ class VectorTest extends \yiiunit\TestCase
$array
=
array
(
$this
->
item3
,
$this
->
item1
);
$this
->
vector
->
copyFrom
(
$array
);
$this
->
assertTrue
(
count
(
$array
)
==
2
&&
$this
->
vector
[
0
]
===
$this
->
item3
&&
$this
->
vector
[
1
]
===
$this
->
item1
);
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
vector
->
copyFrom
(
$this
);
}
...
...
@@ -150,7 +150,7 @@ class VectorTest extends \yiiunit\TestCase
$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\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$this
->
vector
->
mergeWith
(
$this
);
}
...
...
@@ -164,7 +164,7 @@ class VectorTest extends \yiiunit\TestCase
{
$this
->
assertTrue
(
$this
->
vector
[
0
]
===
$this
->
item1
);
$this
->
assertTrue
(
$this
->
vector
[
1
]
===
$this
->
item2
);
$this
->
setExpectedException
(
'yii\base\Invalid
Call
Exception'
);
$this
->
setExpectedException
(
'yii\base\Invalid
Param
Exception'
);
$a
=
$this
->
vector
[
2
];
}
...
...
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