Skip to content

Commit

Permalink
Merge pull request #25 from cPintiuta/issue-23
Browse files Browse the repository at this point in the history
fixed issue related to lamians log on higher version
  • Loading branch information
arhimede committed Jul 25, 2023
2 parents 4c39fef + 360c0dd commit d578397
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"php": "~8.1.0 || ~8.2.0",
"psr/http-message": "^1.0.1",
"laminas/laminas-servicemanager": "^3.10.0",
"laminas/laminas-log": "2.15.2",
"laminas/laminas-log": "^2.16",
"dotkernel/dot-mail": "^3.0.0"
},
"require-dev": {
Expand Down
13 changes: 8 additions & 5 deletions src/Factory/LoggerAbstractServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ class LoggerAbstractServiceFactory extends \Laminas\Log\LoggerAbstractServiceFac
{
protected const PREFIX = 'dot-log';

/** @var string $configKey */
protected $configKey = 'dot_log';

protected string $subConfigKey = 'loggers';

public function __construct(string $configKey = 'dot_log')
{
parent::__construct($configKey);
}

/**
* @param string $requestedName
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function canCreate(ContainerInterface $container, $requestedName): bool
{
Expand Down Expand Up @@ -71,11 +75,10 @@ protected function getConfig(ContainerInterface $services): array
}

/**
* @param array $config
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function processConfig(&$config, ContainerInterface $services): void
protected function processConfig(array &$config, ContainerInterface $services): void
{
if (isset($config['writers'])) {
foreach ($config['writers'] as $index => $writerConfig) {
Expand Down
9 changes: 9 additions & 0 deletions test/Factory/LoggerAbstractServiceFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;

class LoggerAbstractServiceFactoryTest extends TestCase
{
Expand All @@ -33,6 +35,9 @@ protected function setUp(): void
$this->factory = new LoggerAbstractServiceFactory();
}

/**
* @throws ContainerExceptionInterface
*/
public function testWillInstantiate()
{
$this->container
Expand All @@ -49,6 +54,10 @@ public function testWillInstantiate()
$this->assertInstanceOf(Logger::class, $factory);
}

/**
* @throws NotFoundExceptionInterface
* @throws ContainerExceptionInterface
*/
public function testCanCreate(): void
{
$this->container->expects($this->once())
Expand Down

0 comments on commit d578397

Please sign in to comment.