Skip to content

Commit

Permalink
paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 26, 2023
1 parent 1ad270b commit 9d6bd51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
parameters:
paths:
- src
- tests/unit
- tests

excludePaths:
- tests/Fixture/*

level: 8
22 changes: 11 additions & 11 deletions tests/unit/AnalyserTest.php → tests/AnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function test(): void
'maximumMethodsPerClass' => 4,
],
$this->analyser->countFiles(
[__DIR__ . '/../Fixture/source.php'],
[__DIR__ . '/Fixture/source.php'],
),
0.1
);
Expand All @@ -77,7 +77,7 @@ public function test(): void
#[DataProvider('issue126Provider')]
public function testIssue126IsFixed(int $fileNumber, int $cloc): void
{
$file = __DIR__ . '/../Fixture/issue_126/issue_126_' . $fileNumber . '.php';
$file = __DIR__ . '/Fixture/issue_126/issue_126_' . $fileNumber . '.php';
$result = $this->analyser->countFiles([$file]);

$assertString = sprintf(
Expand Down Expand Up @@ -111,7 +111,7 @@ public function testIssue138IsFixed(): void
{
$result = $this->analyser->countFiles(
[
__DIR__ . '/../Fixture/issue_138.php',
__DIR__ . '/Fixture/issue_138.php',
],
);

Expand All @@ -120,28 +120,28 @@ public function testIssue138IsFixed(): void

public function testDeclareIsNotLogicalLine(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/with_declare.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/with_declare.php']);

$this->assertSame(0, $result['llocGlobal']);
}

public function testNamespaceIsNotLogicalLine(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/with_namespace.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/with_namespace.php']);

$this->assertSame(0, $result['llocGlobal']);
}

public function testImportIsNotLogicalLine(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/with_import.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/with_import.php']);

$this->assertSame(0, $result['llocGlobal']);
}

public function test_it_makes_a_distinction_between_public_and_non_public_class_constants(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/class_constants.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/class_constants.php']);
$this->assertSame(2, $result['publicClassConstants']);
$this->assertSame(3, $result['nonPublicClassConstants']);
$this->assertSame(5, $result['classConstants']);
Expand All @@ -150,7 +150,7 @@ public function test_it_makes_a_distinction_between_public_and_non_public_class_

public function test_it_collects_the_number_of_final_non_final_and_abstract_classes(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/classes.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/classes.php']);
$this->assertSame(9, $result['classes']);
$this->assertSame(2, $result['finalClasses']);
$this->assertSame(3, $result['nonFinalClasses']);
Expand All @@ -159,7 +159,7 @@ public function test_it_collects_the_number_of_final_non_final_and_abstract_clas

public function test_it_makes_a_distinction_between_protected_and_private_methods(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/methods.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/methods.php']);
$this->assertSame(2, $result['publicMethods']);
$this->assertSame(1, $result['protectedMethods']);
$this->assertSame(3, $result['privateMethods']);
Expand All @@ -168,15 +168,15 @@ public function test_it_makes_a_distinction_between_protected_and_private_method

public function test_it_provides_average_minimum_and_maximum_number_of_methods_per_class(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/methods_per_class.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/methods_per_class.php']);
$this->assertSame(2.0, $result['averageMethodsPerClass']);
$this->assertSame(0, $result['minimumMethodsPerClass']);
$this->assertSame(4, $result['maximumMethodsPerClass']);
}

public function test_use_trait_is_not_counted_as_logical_line(): void
{
$result = $this->analyser->countFiles([__DIR__ . '/../Fixture/class_using_trait.php']);
$result = $this->analyser->countFiles([__DIR__ . '/Fixture/class_using_trait.php']);
$this->assertSame(1, $result['lloc']);
$this->assertSame(1, $result['llocClasses']);
}
Expand Down

0 comments on commit 9d6bd51

Please sign in to comment.