Skip to content

Commit 24800df

Browse files
committed
Add NsDirUtilTest to cover NsDirUtil at 100% coverage.
1 parent a87833c commit 24800df

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/src/NsDirUtilTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace Ock\ClassFilesIterator\Tests;
6+
7+
use Ock\ClassFilesIterator\NsDirUtil;
8+
use PHPUnit\Framework\TestCase;
9+
10+
class NsDirUtilTest extends TestCase {
11+
12+
use ExceptionTestTrait;
13+
14+
public function testTerminateNamespace(): void {
15+
$f = NsDirUtil::terminateNamespace(...);
16+
$this->assertSame('Acme\Zoo\Animal\\', $f('Acme\Zoo\Animal'));
17+
$this->assertSame('Acme\\', $f('Acme'));
18+
$this->assertSame('', $f(''));
19+
$this->callAndAssertException(\InvalidArgumentException::class, fn () => $f('Acme\\Zoo\\Animal\\'));
20+
$this->callAndAssertException(\InvalidArgumentException::class, fn () => $f('\\Acme\\Zoo\\Animal'));
21+
}
22+
23+
}

0 commit comments

Comments
 (0)