@@ 32-48 (lines=17) @@ | ||
29 | */ |
|
30 | abstract public function buildMap(int $behavior = ObjectMapInterface::DEFAULT); |
|
31 | ||
32 | public function testMap() |
|
33 | { |
|
34 | $map = $this->buildMap(); |
|
35 | ||
36 | $key = new stdClass(); |
|
37 | $value = new stdClass(); |
|
38 | ||
39 | $this->assertSame(0, $map->count()); |
|
40 | $map->put($key, $value); |
|
41 | $this->assertSame(1, $map->count()); |
|
42 | ||
43 | $value = null; |
|
44 | $this->assertSame(1, $map->count()); |
|
45 | ||
46 | $key = null; |
|
47 | $this->assertSame(1, $map->count()); |
|
48 | } |
|
49 | ||
50 | public function testWeakKeyMap() |
|
51 | { |
|
@@ 50-66 (lines=17) @@ | ||
47 | $this->assertSame(1, $map->count()); |
|
48 | } |
|
49 | ||
50 | public function testWeakKeyMap() |
|
51 | { |
|
52 | $map = $this->buildMap(ObjectMapInterface::WEAK_KEY); |
|
53 | ||
54 | $key = new stdClass(); |
|
55 | $value = new stdClass(); |
|
56 | ||
57 | $this->assertSame(0, $map->count()); |
|
58 | $map->put($key, $value); |
|
59 | $this->assertSame(1, $map->count()); |
|
60 | ||
61 | $value = null; |
|
62 | $this->assertSame(1, $map->count()); |
|
63 | ||
64 | $key = null; |
|
65 | $this->assertSame(0, $map->count()); |
|
66 | } |
|
67 | ||
68 | public function testWeakValueMap() |
|
69 | { |
|
@@ 68-84 (lines=17) @@ | ||
65 | $this->assertSame(0, $map->count()); |
|
66 | } |
|
67 | ||
68 | public function testWeakValueMap() |
|
69 | { |
|
70 | $map = $this->buildMap(ObjectMapInterface::WEAK_VALUE); |
|
71 | ||
72 | $key = new stdClass(); |
|
73 | $value = new stdClass(); |
|
74 | ||
75 | $this->assertSame(0, $map->count()); |
|
76 | $map->put($key, $value); |
|
77 | $this->assertSame(1, $map->count()); |
|
78 | ||
79 | $key = null; |
|
80 | $this->assertSame(1, $map->count()); |
|
81 | ||
82 | $value = null; |
|
83 | $this->assertSame(0, $map->count()); |
|
84 | } |
|
85 | ||
86 | public function testWeakKeyValueMap() |
|
87 | { |