Skip to content

Commit

Permalink
Fix units
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Koprek committed Oct 23, 2024
1 parent bea5ee6 commit 6e151ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/RunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

use function is_string;

use const E_USER_ERROR;
use const E_USER_WARNING;

Check failure on line 33 in test/RunnerTest.php

View workflow job for this annotation

GitHub Actions / QA Checks (PHPCodeSniffer [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Type E_USER_WARNING is not used in this file.
use const E_WARNING;
use const PHP_MAJOR_VERSION;

Expand Down Expand Up @@ -347,13 +347,13 @@ public function testPHPWarningResultsInFailure(): void

public function testPHPUserErrorResultsInFailure(): void
{
$check = new TriggerUserError('error', E_USER_ERROR);
$check = new TriggerUserError('error');

Check failure on line 350 in test/RunnerTest.php

View workflow job for this annotation

GitHub Actions / QA Checks (Psalm [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-action@v1, ...

TooFewArguments

test/RunnerTest.php:350:18: TooFewArguments: Too few arguments for LaminasTest\Diagnostics\TestAsset\Check\TriggerUserError::__construct - expecting severity to be passed (see https://psalm.dev/025)
$this->runner->addCheck($check);
$results = $this->runner->run();

self::assertInstanceOf(Failure::class, $results[$check]);
self::assertInstanceOf(ErrorException::class, $results[$check]->getData());
self::assertSame(E_USER_ERROR, $results[$check]->getData()->getSeverity());
self::assertSame((new ErrorException())->getSeverity(), $results[$check]->getData()->getSeverity());
}

public function testBreakOnFirstFailure(): void
Expand Down
5 changes: 1 addition & 4 deletions test/TestAsset/Check/TriggerUserError.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ public function __construct(private string $message, private int $severity, priv
{
}

/** @return bool */
public function check()
{
trigger_error($this->message, $this->severity);

return $this->result;
throw new \ErrorException($this->message);

Check failure on line 20 in test/TestAsset/Check/TriggerUserError.php

View workflow job for this annotation

GitHub Actions / QA Checks (PHPCodeSniffer [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Class \ErrorException should not be referenced via a fully qualified name, but via a use statement.
}
}

0 comments on commit 6e151ac

Please sign in to comment.