-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathTestMslsGetSet.php
70 lines (46 loc) · 1.36 KB
/
TestMslsGetSet.php
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
64
65
66
67
68
69
70
<?php declare( strict_types=1 );
namespace lloc\MslsTests;
use lloc\Msls\MslsGetSet;
class TestMslsGetSet extends MslsUnitTestCase {
public function test_unset(): void {
$obj = new MslsGetSet();
$this->assertTrue( $obj->is_empty() );
$obj->abc = 'Test';
$this->assertFalse( $obj->is_empty() );
unset( $obj->abc );
$this->assertTrue( $obj->is_empty() );
}
public function test_set_empty(): void {
$obj = new MslsGetSet();
$this->assertTrue( $obj->is_empty() );
$obj->abc = 'Test';
$this->assertFalse( $obj->is_empty() );
$obj->abc = '';
$this->assertTrue( $obj->is_empty() );
}
public function test_set(): void {
$obj = new MslsGetSet();
$obj->abc = 'test';
$this->assertEquals( 'test', $obj->abc );
$this->assertTrue( isset( $obj->abc ) );
}
public function test_isset(): void {
$obj = new MslsGetSet();
$this->assertTrue( $obj->is_empty() );
$obj->abc = 'test';
$this->assertTrue( isset( $obj->abc ) );
$this->assertEquals( 'test', $obj->abc );
}
public function test_has_value(): void {
$obj = new MslsGetSet();
$obj->a_key = 'test';
$this->assertTrue( $obj->has_value( 'a_key' ) );
}
public function test_get_array(): void {
$obj = new MslsGetSet();
$obj->temp = 'test';
$this->assertEquals( [ 'temp' => 'test' ], $obj->get_arr() );
$obj->reset();
$this->assertEquals( [], $obj->get_arr() );
}
}