Skip to content

Commit

Permalink
report wrong static declaration while running unit tests (to solve is…
Browse files Browse the repository at this point in the history
…sue #73)
  • Loading branch information
llaville committed Apr 1, 2021
1 parent 6669e9d commit 639698d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Reference/GenericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Bartlett\CompatInfoDb\Domain\ValueObject\Dependency;
use Bartlett\CompatInfoDb\Domain\ValueObject\Extension;

use Bartlett\CompatInfoDb\Domain\ValueObject\Function_;
use Composer\Semver\Semver;

use PHPUnit\Framework\ExpectationFailedException;
Expand Down Expand Up @@ -189,6 +190,12 @@ private function provideReferenceValues(array $elements, string $opt): Generator
continue;
}

if ($element instanceof Function_) {
$range['is_abstract'] = $element->isAbstract();
$range['is_final'] = $element->isFinal();
$range['is_static'] = $element->isStatic();
}

foreach ($element->getDependencies() as $dependency) {
/** @var Dependency $dependency */
$ver = $this->getPrettyVersion($dependency->getName());
Expand Down Expand Up @@ -815,6 +822,18 @@ public function testGetMethodsFromReference(): void
$methodExists,
"Class Method '$element', found in Reference, does not exists."
);

if ($method->isStatic()) {
$this->assertTrue(
$range['is_static'],
"Class Method '$element', found in Reference, should be declared as static."
);
} else {
$this->assertFalse(
$range['is_static'],
"Class Method '$element', found in Reference, should not be declared as static."
);
}
} else {
$this->assertFalse(
$methodExists,
Expand Down

0 comments on commit 639698d

Please sign in to comment.