Files
kupshop/bundles/KupShop/KupShopBundle/Tests/SentryLoggerTest.php
2025-08-02 16:30:27 +02:00

52 lines
1.9 KiB
PHP

<?php
namespace KupShop\KupShopBundle\Tests;
use Composer\InstalledVersions;
use KupShop\CatalogBundle\Search\Exception\FulltextException;
use KupShop\PohodaBundle\Exceptions\PohodaException;
use Sentry\Event;
use Sentry\Transport\Result;
use Sentry\Transport\ResultStatus;
use Sentry\Transport\TransportInterface;
class SentryLoggerTest extends \PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass(): void
{
self::markTestSkipped('Viz komentář níže.');
}
public function testCustomDataInterface()
{
// TODO: Tohle nějak pořešit ....
// if (InstalledVersions::getVersion('sentry/sentry') <= 2) {
// $transport = new class() implements TransportInterface {
// public $event;
//
// public function send(Event $event): Result
// {
// $this->event = $event;
//
// return new Result(ResultStatus::success());
// }
//
// public function close(int $timeout = null): Result
// {
// return new Result(ResultStatus::success());
// }
// };
//
// $client = new \KupShop\KupShopBundle\Util\Logging\SentryLogger(['transport' => $transport]);
// $exception = new FulltextException('First level', ['layer1' => 'testik'], new PohodaException('Second Level', '', ['layer2' => 'pokus']));
// $client->captureException($exception, ['extra' => ['layer0' => 'ahoj']]);
//
// $this->assertEquals([
// 'layer0' => 'ahoj',
// 'layer1' => 'testik',
// 'layer2' => 'pokus',
// ], $transport->event->getExtra()['extra']);
// }
}
}