-
-
Notifications
You must be signed in to change notification settings - Fork 467
/
unsettest.zep
63 lines (50 loc) · 1.08 KB
/
unsettest.zep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Unset statement tests
*/
namespace Stub;
class Unsettest
{
protected property {get};
public function has(var key)
{
return isset this->property[key];
}
public function addValueToProperty(var key, var value)
{
let this->property[key] = value;
}
public function testUnsetValueFromProperty(var key)
{
unset(this->property[key]);
}
public function testUnsetFromArray(var arrayParameter)
{
unset(arrayParameter[0]);
return arrayParameter;
}
public function testUnsetFromArrayByIndexVar(var arrayParameter, var index)
{
unset(arrayParameter[index]);
return arrayParameter;
}
public function testUnsetProperty()
{
unset(this->property);
return this->property;
}
public function testStdClassUnset()
{
var simpleObject;
let simpleObject = new \stdClass();
let simpleObject->property1 = 12345;
let simpleObject->property2 = "test";
let simpleObject->property3 = 12345;
unset(simpleObject->property2);
return simpleObject;
}
public function testUnsetTypedArray(array arr, string key)
{
unset(arr[key]);
return arr;
}
}