-
-
Notifications
You must be signed in to change notification settings - Fork 166
/
AnalyserTest.php
45 lines (42 loc) · 1.49 KB
/
AnalyserTest.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
<?php declare(strict_types=1);
/*
* This file is part of PHPLOC.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\PHPLOC;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(Analyser::class)]
#[UsesClass(Result::class)]
#[Small]
final class AnalyserTest extends TestCase
{
public function testAnalysesFiles(): void
{
$result = (new Analyser)->analyse(
[
__DIR__ . '/../_fixture/example_function.php',
__DIR__ . '/../_fixture/ExampleClass.php',
__DIR__ . '/../_fixture/ExampleInterface.php',
__DIR__ . '/../_fixture/ExampleTrait.php',
],
false,
);
$this->assertFalse($result->hasErrors());
$this->assertSame(1, $result->directories());
$this->assertSame(4, $result->files());
$this->assertSame(152, $result->linesOfCode());
$this->assertSame(32, $result->commentLinesOfCode());
$this->assertSame(120, $result->nonCommentLinesOfCode());
$this->assertSame(40, $result->logicalLinesOfCode());
$this->assertSame(1, $result->functions());
$this->assertSame(2, $result->classesOrTraits());
$this->assertSame(2, $result->methods());
}
}