Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions phpstan-baseline.php
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
<?php declare(strict_types = 1);

$ignoreErrors = [];
$ignoreErrors[] = [
// identifier: staticMethod.notFound
'message' => '#^Call to an undefined static method BlitzPHP\\\\Utilities\\\\Iterable\\\\Arr\\:\\:countRecursive\\(\\)\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Cli/Commands/Translation/TranslationsFinder.php',
];
$ignoreErrors[] = [
// identifier: staticMethod.notFound
'message' => '#^Call to an undefined static method BlitzPHP\\\\Utilities\\\\Iterable\\\\Arr\\:\\:diffRecursive\\(\\)\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Cli/Commands/Translation/TranslationsFinder.php',
];
$ignoreErrors[] = [
// identifier: method.notFound
'message' => '#^Call to an undefined method BlitzPHP\\\\Traits\\\\Mixins\\\\HigherOrderCollectionProxy\\:\\:__invoke\\(\\)\\.$#',
Expand Down
18 changes: 12 additions & 6 deletions spec/system/cache/Cache.spec.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,8 @@
$cache = new Cache();
Cache::disable();

$factory = ReflectionHelper::getPrivateMethodInvoker($cache, 'factory');
$manager = ReflectionHelper::getPrivateProperty($cache, 'manager');
$factory = ReflectionHelper::getPrivateMethodInvoker($manager, 'factory');

expect(call_user_func($factory))->toBeAnInstanceOf(Dummy::class);

Expand All@@ -31,9 +32,11 @@
it('Leve une exception lorsque les gestionnaires valides ne sont pas definis', function (): void {
$cache = new Cache();

expect(ReflectionHelper::getPrivateProperty($cache, 'config'))->toBe([]);
$manager = ReflectionHelper::getPrivateProperty($cache, 'manager');

$factory = ReflectionHelper::getPrivateMethodInvoker($cache, 'factory');
expect(ReflectionHelper::getPrivateProperty($manager, 'config'))->toBe([]);

$factory = ReflectionHelper::getPrivateMethodInvoker($manager, 'factory');

expect(fn() => call_user_func($factory))->toThrow(new InvalidArgumentException());
});
Expand All@@ -43,14 +46,16 @@
$config['valid_handlers'] = config('cache.valid_handlers');
$cache = new Cache($config);

$factory = ReflectionHelper::getPrivateMethodInvoker($cache, 'factory');
$manager = ReflectionHelper::getPrivateProperty($cache, 'manager');
$factory = ReflectionHelper::getPrivateMethodInvoker($manager, 'factory');
expect(fn() => call_user_func($factory))->toThrow(new InvalidArgumentException());


$config['handler'] = 'fake_handler';
$cache = new Cache($config);

$factory = ReflectionHelper::getPrivateMethodInvoker($cache, 'factory');
$manager = ReflectionHelper::getPrivateProperty($cache, 'manager');
$factory = ReflectionHelper::getPrivateMethodInvoker($manager, 'factory');
expect(fn() => call_user_func($factory))->toThrow(new InvalidArgumentException());
});

Expand All@@ -60,7 +65,8 @@
$config['handler'] = 'fake_handler';
$cache = new Cache($config);

$factory = ReflectionHelper::getPrivateMethodInvoker($cache, 'factory');
$manager = ReflectionHelper::getPrivateProperty($cache, 'manager');
$factory = ReflectionHelper::getPrivateMethodInvoker($manager, 'factory');
expect(call_user_func($factory))->toBeAnInstanceOf(Dummy::class);
});
});
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@

use function Kahlan\expect;

describe('Commandes / TranslationsFinder', function (): void {
xdescribe('Commandes / TranslationsFinder', function (): void {
afterEach(function (): void {
COH::tearDown();

Expand Down
13 changes: 12 additions & 1 deletion src/Cli/Console/Command.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -665,8 +665,19 @@ public function __isset(string $key): bool
*
* @return void
*/
private function initProps()
protected function initProps()
{
if (! is_cli()) {
if (! file_exists($in = TEMP_PATH . 'cli_input')) {
file_put_contents($in, '', LOCK_EX);
}
if (! file_exists($ou = TEMP_PATH . 'cli_output')) {
file_put_contents($ou, '', LOCK_EX);
}

$this->app->io(new Interactor($in, $ou));
}

$this->io = $this->app->io();
$this->writer = $this->io->writer();
$this->reader = $this->io->reader();
Expand Down
Loading