Skip to content

Commit 7a079c9

Browse files
[11.x] Improvement Test for repository class (#51018)
* test(RepositoryTest): improvement test for prepend method * test(RepositoryTest): improvement test for get method when key contain dot * test(RepositoryTest): improvement test for push method * wip
1 parent 8f82ed6 commit 7a079c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/Config/RepositoryTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public function testGetValueWhenKeyContainDot()
5656
$this->assertNull(
5757
$this->repository->get('a.b.c')
5858
);
59+
60+
$this->assertNull($this->repository->get('x.y.z'));
61+
$this->assertNull($this->repository->get('.'));
5962
}
6063

6164
public function testGetBooleanValue()
@@ -178,10 +181,13 @@ public function testPrepend()
178181
{
179182
$this->assertSame('aaa', $this->repository->get('array.0'));
180183
$this->assertSame('zzz', $this->repository->get('array.1'));
184+
181185
$this->repository->prepend('array', 'xxx');
182186
$this->assertSame('xxx', $this->repository->get('array.0'));
183187
$this->assertSame('aaa', $this->repository->get('array.1'));
184188
$this->assertSame('zzz', $this->repository->get('array.2'));
189+
$this->assertNull($this->repository->get('array.3'));
190+
$this->assertCount(3, $this->repository->get('array'));
185191
}
186192

187193
public function testPush()
@@ -192,6 +198,8 @@ public function testPush()
192198
$this->assertSame('aaa', $this->repository->get('array.0'));
193199
$this->assertSame('zzz', $this->repository->get('array.1'));
194200
$this->assertSame('xxx', $this->repository->get('array.2'));
201+
202+
$this->assertCount(3, $this->repository->get('array'));
195203
}
196204

197205
public function testPrependWithNewKey()

0 commit comments

Comments
 (0)