Skip to content

Commit

Permalink
Merge pull request #517 from eliashaeussler/task/transient-logger
Browse files Browse the repository at this point in the history
[TASK] Use eliashaeussler/transient-logger for testing
  • Loading branch information
eliashaeussler authored Nov 24, 2023
2 parents 39b9263 + 1b51e7e commit 2295606
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 103 deletions.
8 changes: 4 additions & 4 deletions Tests/Functional/Crawler/ConcurrentUserAgentCrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
namespace EliasHaeussler\Typo3Warming\Tests\Functional\Crawler;

use EliasHaeussler\CacheWarmup;
use EliasHaeussler\TransientLogger;
use EliasHaeussler\Typo3Warming as Src;
use EliasHaeussler\Typo3Warming\Tests;
use Exception;
use PHPUnit\Framework;
use Psr\Log;
use TYPO3\CMS\Core;
use TYPO3\TestingFramework;

Expand Down Expand Up @@ -148,7 +148,7 @@ public function crawlCrawlsGivenUrlsAndStreamsResponses(): void
#[Framework\Attributes\Test]
public function crawlLogsCrawlingResults(): void
{
$logger = new Tests\Functional\Fixtures\Classes\DummyLogger();
$logger = new TransientLogger\TransientLogger();

$this->guzzleClientFactory->handler->append(
new Core\Http\Response(),
Expand All @@ -164,7 +164,7 @@ public function crawlLogsCrawlingResults(): void

$this->subject->crawl($urls);

self::assertCount(1, $logger->log[Log\LogLevel::ERROR]);
self::assertCount(1, $logger->log[Log\LogLevel::INFO]);
self::assertCount(1, $logger->getByLogLevel(TransientLogger\Log\LogLevel::Error));
self::assertCount(1, $logger->getByLogLevel(TransientLogger\Log\LogLevel::Info));
}
}
8 changes: 4 additions & 4 deletions Tests/Functional/Crawler/OutputtingUserAgentCrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
namespace EliasHaeussler\Typo3Warming\Tests\Functional\Crawler;

use EliasHaeussler\CacheWarmup;
use EliasHaeussler\TransientLogger;
use EliasHaeussler\Typo3Warming as Src;
use EliasHaeussler\Typo3Warming\Tests;
use Exception;
use PHPUnit\Framework;
use Psr\Log;
use Symfony\Component\Console;
use TYPO3\CMS\Core;
use TYPO3\TestingFramework;
Expand Down Expand Up @@ -156,7 +156,7 @@ public function crawlSendsCustomUserAgentHeader(): void
#[Framework\Attributes\Test]
public function crawlLogsCrawlingResults(): void
{
$logger = new Tests\Functional\Fixtures\Classes\DummyLogger();
$logger = new TransientLogger\TransientLogger();

$this->guzzleClientFactory->handler->append(
new Core\Http\Response(),
Expand All @@ -172,7 +172,7 @@ public function crawlLogsCrawlingResults(): void

$this->subject->crawl($urls);

self::assertCount(1, $logger->log[Log\LogLevel::ERROR]);
self::assertCount(1, $logger->log[Log\LogLevel::INFO]);
self::assertCount(1, $logger->getByLogLevel(TransientLogger\Log\LogLevel::Error));
self::assertCount(1, $logger->getByLogLevel(TransientLogger\Log\LogLevel::Info));
}
}
64 changes: 0 additions & 64 deletions Tests/Functional/Fixtures/Classes/DummyLogger.php

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"eliashaeussler/php-cs-fixer-config": "^1.2",
"eliashaeussler/phpstan-config": "^2.1",
"eliashaeussler/rector-config": "^2.0",
"eliashaeussler/transient-logger": "^1.0",
"eliashaeussler/typo3-codeception-helper": "^1.0",
"ergebnis/composer-normalize": "^2.30",
"helhum/typo3-console": "^8.0",
Expand Down
58 changes: 57 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,6 @@ parameters:
count: 1
path: Tests/Acceptance/Support/Helper/PageTree.php

-
message: "#^Parameter \\#1 \\$level \\('alert'\\|'critical'\\|'debug'\\|'emergency'\\|'error'\\|'info'\\|'notice'\\|'warning'\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\AbstractLogger\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^Parameter \\#1 \\$level \\('alert'\\|'critical'\\|'debug'\\|'emergency'\\|'error'\\|'info'\\|'notice'\\|'warning'\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\LoggerInterface\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^Parameter \\#1 \\$level \\('alert'\\|'critical'\\|'debug'\\|'emergency'\\|'error'\\|'info'\\|'notice'\\|'warning'\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\LoggerTrait\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^Parameter \\#3 \\$context \\(array\\<string, mixed\\>\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$context \\(array\\) of method Psr\\\\Log\\\\AbstractLogger\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^Parameter \\#3 \\$context \\(array\\<string, mixed\\>\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$context \\(array\\) of method Psr\\\\Log\\\\LoggerInterface\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^Parameter \\#3 \\$context \\(array\\<string, mixed\\>\\) of method EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyLogger\\:\\:log\\(\\) should be contravariant with parameter \\$context \\(array\\) of method Psr\\\\Log\\\\LoggerTrait\\:\\:log\\(\\)$#"
count: 1
path: Tests/Functional/Fixtures/Classes/DummyLogger.php

-
message: "#^EliasHaeussler\\\\Typo3Warming\\\\Tests\\\\Functional\\\\Fixtures\\\\Classes\\\\DummyPackageManager\\:\\:__construct\\(\\) does not call parent constructor from TYPO3\\\\CMS\\\\Core\\\\Package\\\\PackageManager\\.$#"
count: 1
Expand Down

0 comments on commit 2295606

Please sign in to comment.