Skip to content

Commit 9243523

Browse files
committed
Update tests
1 parent 138d384 commit 9243523

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

src/Iterator/Concern/RecursiveGraphIteratorTrait.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ public function hasChildren(): bool
1515
{
1616
/** @var RecursiveGraphIterator|RecursiveMutableGraphIterator $this */
1717
if (($current = $this->current()) === false) {
18+
// @codeCoverageIgnoreStart
1819
return false;
20+
// @codeCoverageIgnoreEnd
1921
}
2022

2123
return is_object($current) || is_array($current);
@@ -25,7 +27,9 @@ public function getChildren(): ?self
2527
{
2628
/** @var RecursiveGraphIterator|RecursiveMutableGraphIterator $this */
2729
if (($current = $this->current()) === false) {
30+
// @codeCoverageIgnoreStart
2831
return null;
32+
// @codeCoverageIgnoreEnd
2933
}
3034

3135
$key = current($this->Keys);
@@ -39,6 +43,8 @@ public function getChildren(): ?self
3943
return new self($current);
4044
}
4145

46+
// @codeCoverageIgnoreStart
4247
return null;
48+
// @codeCoverageIgnoreEnd
4349
}
4450
}

src/Iterator/GraphIterator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ protected function doConstruct(&$graph): void
4747
}
4848

4949
if ($graph instanceof Traversable) {
50+
// @codeCoverageIgnoreStart
5051
throw new LogicException('Traversable objects are not supported');
52+
// @codeCoverageIgnoreEnd
5153
}
5254

5355
$this->Graph = $graph;
@@ -81,7 +83,9 @@ public function current()
8183
public function key()
8284
{
8385
if (($key = current($this->Keys)) === false) {
86+
// @codeCoverageIgnoreStart
8487
return null;
88+
// @codeCoverageIgnoreEnd
8589
}
8690
return $key;
8791
}

src/Iterator/RecursiveCallbackIterator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public function getChildren(): ?self
6767

6868
return
6969
$children === null
70+
// @codeCoverageIgnoreStart
7071
? null
72+
// @codeCoverageIgnoreEnd
7173
: new self($children, $this->Callback);
7274
}
7375
}

src/Iterator/RecursiveMutableGraphIterator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class RecursiveMutableGraphIterator extends MutableGraphIterator implements \Rec
2323
public function maybeConvertToArray()
2424
{
2525
if (($current = $this->current()) === false) {
26+
// @codeCoverageIgnoreStart
2627
return $this;
28+
// @codeCoverageIgnoreEnd
2729
}
2830

2931
if (is_object($current) && $this->hasChildren()) {

tests/unit/Utility/PcreTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,11 @@ public function testReplaceCallbackArray(): void
4242
$this->expectExceptionMessage('Call to preg_replace_callback_array() failed with PREG_BACKTRACK_LIMIT_ERROR');
4343
Pcre::replaceCallbackArray(['/(?:\D+|<\d+>)*[!?]/' => fn() => ''], 'foobar foobar foobar');
4444
}
45+
46+
public function testSplit(): void
47+
{
48+
$this->expectException(PcreErrorException::class);
49+
$this->expectExceptionMessage('Call to preg_split() failed with PREG_BACKTRACK_LIMIT_ERROR');
50+
Pcre::split('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');
51+
}
4552
}

0 commit comments

Comments
 (0)