Nette\Collections\Set test
Adding numeric
Adding numeric
Adding non-numeric
InvalidArgumentException: Item must be numeric type.
Adding Jack
bool(TRUE)
Adding Mary
bool(TRUE)
Adding Mary second time
bool(FALSE)
Adding Larry
bool(TRUE)
Adding foo
InvalidArgumentException: Item must be 'Person' object.
Removing Larry
bool(TRUE)
Removing Larry second time
bool(FALSE)
Removing foo
bool(FALSE)
Contains Jack?
bool(TRUE)
Contains Larry?
bool(FALSE)
Contains foo?
bool(FALSE)
Count: 2
Count: 2
Get Interator:
My name is Jack
My name is Mary
(array):
array(2) {
"d3b510054ef9011ffda8f5424b5f4c60" => object(Person) (1) {
"name" private => string(4) "Jack"
}
"0cd35b6e967a98fc602a338c925cb5e2" => object(Person) (1) {
"name" private => string(4) "Mary"
}
}
Clearing
Adding 'Jack'
bool(TRUE)
Adding 'Mary'
bool(TRUE)
Adding 'Mary' second time
bool(FALSE)
Adding 'Larry'
bool(TRUE)
Removing 'Larry'
bool(TRUE)
Removing 'Larry' second time
bool(FALSE)
array(2) {
0 => string(4) "Jack"
1 => string(4) "Mary"
}
Construct from collection
InvalidArgumentException: Item must be 'Person' object.
Construct from array
InvalidArgumentException: Item must be 'Person' object.
Construct as readonly
bool(TRUE)
Adding Jack
InvalidStateException: Cannot modify a frozen object 'Set'.
Removing Jack
InvalidStateException: Cannot modify a frozen object 'Set'.
Clearing
InvalidStateException: Cannot modify a frozen object 'Set'.
Contains Jack?
bool(TRUE)