Skip to content

Commit

Permalink
Finalize StorageInterface constants + Fix tests (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Jun 30, 2024
1 parent c3fd44d commit a679425
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 60 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"rector/rector": "^1.0.0",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^5.18",
"vimeo/psalm": "^5.25",
"yiisoft/error-handler": "^3.0",
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/log": "^2.0",
Expand Down
3 changes: 1 addition & 2 deletions src/DebugServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function getDefinitions(): array

public function getExtensions(): array
{
return [
];
return [];
}
}
17 changes: 14 additions & 3 deletions src/Storage/StorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@
*/
interface StorageInterface
{
public const TYPE_SUMMARY = 'summary';
public const TYPE_DATA = 'data';
public const TYPE_OBJECTS = 'objects';
/**
* @psalm-suppress MissingClassConstType
*/
final public const TYPE_SUMMARY = 'summary';

/**
* @psalm-suppress MissingClassConstType
*/
final public const TYPE_DATA = 'data';

/**
* @psalm-suppress MissingClassConstType
*/
final public const TYPE_OBJECTS = 'objects';

/**
* Add collector to get debug data from
Expand Down
25 changes: 6 additions & 19 deletions tests/Unit/DebugServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,21 @@
namespace Yiisoft\Yii\Debug\Tests\Unit;

use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\EventDispatcher\ListenerProviderInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Psr\Container\ContainerInterface;
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\EventDispatcher\Dispatcher\Dispatcher;
use Yiisoft\EventDispatcher\Provider\Provider;
use Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy;
use Yiisoft\Yii\Debug\DebugServiceProvider;
use Yiisoft\Yii\Debug\Collector\EventDispatcherInterfaceProxy;
use Yiisoft\Yii\Debug\Collector\LoggerInterfaceProxy;

final class DebugServiceProviderTest extends TestCase
{
public function testRegister(): void
{
$config = ContainerConfig::create()
->withDefinitions([
LoggerInterface::class => NullLogger::class,
EventDispatcherInterface::class => Dispatcher::class,
ListenerProviderInterface::class => Provider::class,
])
->withProviders([
new DebugServiceProvider(),
]);
$config = ContainerConfig::create()->withProviders([
new DebugServiceProvider(),
]);
$container = new Container($config);

$this->assertInstanceOf(LoggerInterfaceProxy::class, $container->get(LoggerInterface::class));
$this->assertInstanceOf(EventDispatcherInterfaceProxy::class, $container->get(EventDispatcherInterface::class));
$this->assertInstanceOf(ContainerInterfaceProxy::class, $container->get(ContainerInterface::class));
}
}
35 changes: 0 additions & 35 deletions tests/Unit/ProxyServiceProviderTest.php

This file was deleted.

0 comments on commit a679425

Please sign in to comment.