Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']
name: PHP ${{ matrix.php-versions }} Test
steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ fluent logger for laravel

## Versions

| Framework | Library |
|------------------------|---------------------------------|
| Laravel / Lumen < v10 | ytake/laravel-fluent-logger: ^5 |
| Laravel / Lumen v10 | ytake/laravel-fluent-logger: ^6 |
| Laravel / Lumen >= v11 | ytake/laravel-fluent-logger: ^7 |
| Framework | Library |
|-------------------------|---------------------------------|
| Laravel / Lumen < v10 | ytake/laravel-fluent-logger: ^5 |
| Laravel / Lumen v10 | ytake/laravel-fluent-logger: ^6 |
| Laravel / Lumen v11 | ytake/laravel-fluent-logger: ^7 |
| Laravel / Lumen >= v12 | ytake/laravel-fluent-logger: ^8 |


## usage
Expand All @@ -34,7 +35,7 @@ or composer.json

```json
"require": {
"ytake/laravel-fluent-logger": "^7.0"
"ytake/laravel-fluent-logger": "^8.0"
},
```

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
"require": {
"php": "^8.2",
"fluent/logger": "^1.0",
"illuminate/log": "^11.0 | ^12.0",
"illuminate/support": "^11.0 | ^12.0",
"illuminate/config": "^11.0 | ^12.0",
"illuminate/contracts": "^11.0 | ^12.0",
"illuminate/container": "^11.0 | ^12.0",
"illuminate/events": "^11.0 | ^12.0",
"illuminate/log": "^11.0 | ^12.0 | ^13.0",
"illuminate/support": "^11.0 | ^12.0 | ^13.0",
"illuminate/config": "^11.0 | ^12.0 | ^13.0",
"illuminate/contracts": "^11.0 | ^12.0 | ^13.0",
"illuminate/container": "^11.0 | ^12.0 | ^13.0",
"illuminate/events": "^11.0 | ^12.0 | ^13.0",
Comment on lines +22 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is an inconsistency between the composer.json requirements and the README.md versioning table. The README.md indicates that version ^8 of this library is intended for Laravel >= v12, while Laravel v11 should stay on version ^7. However, composer.json still includes ^11.0 in the requirements for illuminate packages. To maintain consistency and prevent Laravel 11 users from accidentally upgrading to version 8 (which may contain environment requirements or testing changes intended for newer Laravel versions), consider removing the ^11.0 constraint.

Suggested change
"illuminate/log": "^11.0 | ^12.0 | ^13.0",
"illuminate/support": "^11.0 | ^12.0 | ^13.0",
"illuminate/config": "^11.0 | ^12.0 | ^13.0",
"illuminate/contracts": "^11.0 | ^12.0 | ^13.0",
"illuminate/container": "^11.0 | ^12.0 | ^13.0",
"illuminate/events": "^11.0 | ^12.0 | ^13.0",
"illuminate/log": "^12.0 | ^13.0",
"illuminate/support": "^12.0 | ^13.0",
"illuminate/config": "^12.0 | ^13.0",
"illuminate/contracts": "^12.0 | ^13.0",
"illuminate/container": "^12.0 | ^13.0",
"illuminate/events": "^12.0 | ^13.0",

"monolog/monolog": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"phpunit/phpunit": ">=10.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using an unbounded upper constraint like >=10.0 for phpunit/phpunit is generally discouraged for libraries. It may allow future major versions of PHPUnit with breaking changes to be installed, which could break your test suite or CI unexpectedly. It is safer to use a defined range that includes the versions you have verified (e.g., ^10.0 || ^11.0).

Suggested change
"phpunit/phpunit": ">=10.0",
"phpunit/phpunit": "^10.0 || ^11.0",

"php-coveralls/php-coveralls": "^2.4",
"illuminate/filesystem": "^11.0 | ^12.0",
"orchestra/testbench": "^9.0 | ^10.0 | ^11.0",
"phpstan/phpstan": "^1.10",
"slevomat/coding-standard": "^6.4",
"squizlabs/php_codesniffer": "^3.5",
Expand Down
3 changes: 1 addition & 2 deletions tests/FluentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Illuminate\Filesystem\Filesystem;
use LogicException;
use Monolog\Level;
use Monolog\Logger;
use Monolog\LogRecord;
use PHPUnit\Framework\TestCase;
use Ytake\LaravelFluent\FluentHandler;

use function unserialize;
Expand All @@ -22,7 +22,6 @@ final class FluentHandlerTest extends TestCase

protected function setUp(): void
{
parent::setUp();
$this->filesystem = new Filesystem();
$this->handler = new FluentHandler(
new StubLogger($this->filesystem)
Expand Down
64 changes: 10 additions & 54 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,23 @@

namespace Tests;

use Illuminate\Config\Repository;
use Illuminate\Container\Container;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Log\Context\ContextServiceProvider;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Ytake\LaravelFluent\LogServiceProvider;

use function assert;

class TestCase extends PHPUnitTestCase
class TestCase extends OrchestraTestCase
{
/** @var Container */
protected $app;

/**
* @throws FileNotFoundException
*/
protected function setUp(): void
protected function getPackageProviders($app): array
{
$this->app = $this->createApplicationContainer();
return [
LogServiceProvider::class,
];
}

/**
* @throws FileNotFoundException
*/
protected function createApplicationContainer(): Container
protected function defineEnvironment($app): void
{
$container = $this->getExtendedContainer();
assert($container instanceof Container || $container instanceof Application);
$filesystem = new Filesystem();
$container->instance('config', new Repository());
$container['config']
->set('fluent', $filesystem->getRequire(__DIR__ . '/config/fluent.php'));
$container['config']
->set('logging', $filesystem->getRequire(__DIR__ . '/config/logging.php'));

$eventProvider = new EventServiceProvider($container);
$eventProvider->register();

// ContextServiceProvider was added in Laravel 11 and is a base service provider in Application. In Laravel 12,
// they added ContextLogProcessor which is added to every Logger instance. See LogManager::get()
$contextProvider = new ContextServiceProvider($container);
$contextProvider->register();

return $container;
}

protected function getExtendedContainer(): Container
{
return new class () extends Container {
public function storagePath(): string
{
return __DIR__ . '/storages';
}

public function runningUnitTests(): bool
{
return true;
}
};
$app['config']->set('fluent', $filesystem->getRequire(__DIR__ . '/config/fluent.php'));
$app['config']->set('logging', $filesystem->getRequire(__DIR__ . '/config/logging.php'));
}
}
Loading