Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
msmakouz committed Sep 14, 2023
1 parent dba27be commit a2334cf
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 42 deletions.
6 changes: 6 additions & 0 deletions src/Bridge/Monolog/tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
use PHPUnit\Framework\TestCase;
use Spiral\Boot\Environment;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Core\Container;

abstract class BaseTestCase extends TestCase
Expand All @@ -17,5 +21,7 @@ protected function setUp(): void
{
$this->container = new Container();
$this->container->bind(EnvironmentInterface::class, new Environment());
$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
}
}
12 changes: 0 additions & 12 deletions src/Bridge/Monolog/tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Monolog\Processor\ProcessorInterface;
use Monolog\ResettableInterface;
use Psr\Log\LoggerInterface;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\Finalizer;
use Spiral\Boot\FinalizerInterface;
Expand All @@ -31,14 +27,6 @@ class FactoryTest extends BaseTestCase
{
use MockeryPHPUnitIntegration;

protected function setUp(): void
{
parent::setUp();

$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
}

public function testDefaultLogger(): void
{
$factory = new LogFactory(new MonologConfig([]), new ListenerRegistry(),$this->container);
Expand Down
6 changes: 0 additions & 6 deletions src/Bridge/Monolog/tests/HandlersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

use Monolog\Handler\NullHandler;
use Monolog\Logger;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\FinalizerInterface;
use Spiral\Config\ConfigManager;
Expand Down Expand Up @@ -46,8 +42,6 @@ public function load(string $section): array
}
));
$this->container->bindSingleton(ListenerRegistryInterface::class, new ListenerRegistry());
$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
$this->container->get(StrategyBasedBootloadManager::class)->bootload([MonologBootloader::class]);
}

Expand Down
6 changes: 0 additions & 6 deletions src/Bridge/Monolog/tests/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\Finalizer;
use Spiral\Boot\FinalizerInterface;
Expand Down Expand Up @@ -50,8 +46,6 @@ public function load(string $section): array

$injector->shouldReceive('createInjection')->once()->andReturn($logger);

$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
$this->container->get(StrategyBasedBootloadManager::class)->bootload([MonologBootloader::class]);
$this->container->get(LoggerInterface::class);

Expand Down
6 changes: 0 additions & 6 deletions src/Bridge/Monolog/tests/ProcessorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
namespace Spiral\Tests\Monolog;

use Monolog\Processor\PsrLogMessageProcessor;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\FinalizerInterface;
use Spiral\Config\ConfigManager;
Expand Down Expand Up @@ -44,8 +40,6 @@ public function load(string $section): array
}
));
$this->container->bindSingleton(ListenerRegistryInterface::class, new ListenerRegistry());
$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
$this->container->get(StrategyBasedBootloadManager::class)->bootload([MonologBootloader::class]);
}

Expand Down
6 changes: 0 additions & 6 deletions src/Bridge/Monolog/tests/RotateHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\FinalizerInterface;
use Spiral\Config\ConfigManager;
Expand Down Expand Up @@ -38,8 +34,6 @@ public function load(string $section): array
}
}
));
$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
$this->container->get(StrategyBasedBootloadManager::class)->bootload([MonologBootloader::class]);

$autowire = new Container\Autowire('log.rotate', [
Expand Down
6 changes: 0 additions & 6 deletions src/Bridge/Monolog/tests/TraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

use Monolog\Logger;
use Psr\Log\NullLogger;
use Spiral\Boot\BootloadManager\DefaultInvokerStrategy;
use Spiral\Boot\BootloadManager\Initializer;
use Spiral\Boot\BootloadManager\InitializerInterface;
use Spiral\Boot\BootloadManager\InvokerStrategyInterface;
use Spiral\Boot\BootloadManager\StrategyBasedBootloadManager;
use Spiral\Boot\FinalizerInterface;
use Spiral\Config\ConfigManager;
Expand Down Expand Up @@ -65,8 +61,6 @@ public function load(string $section): array
}
}
));
$this->container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
$this->container->bind(InitializerInterface::class, Initializer::class);
$this->container->get(StrategyBasedBootloadManager::class)->bootload([MonologBootloader::class]);
$this->container->bind(MonologConfig::class, new MonologConfig());
$this->container->bind(ListenerRegistryInterface::class, new ListenerRegistry());
Expand Down

0 comments on commit a2334cf

Please sign in to comment.