Skip to content

Commit

Permalink
Merge branch 'v2.x-php82' into v2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wakebit committed Apr 24, 2023
2 parents e088211 + 675e0c6 commit a970f48
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.2
coverage: none
tools: none

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.2
coverage: none
tools: none

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.0, 8.1]
php: [8.0, 8.1, 8.2]

name: PHP ${{ matrix.php }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
"require": {
"php": "^8.0|^8.1",
"php": "^8.0|^8.1|^8.2",
"cycle/annotated": "^3.0",
"cycle/database": "^2.0",
"cycle/migrations": "^3.0",
Expand Down
1 change: 1 addition & 0 deletions tests/config/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Wakebit\CycleBridge\Schema\Config\SchemaConfig;
use Wakebit\CycleBridge\Schema\GeneratorQueue;
use Wakebit\CycleBridge\Schema\SchemaFactory;

use function DI\autowire;
use function DI\factory;
use function DI\get;
Expand Down
1 change: 1 addition & 0 deletions tests/config/cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Psr\Container\ContainerInterface;
use Spiral\Tokenizer\Config\TokenizerConfig;
use Wakebit\CycleBridge\Schema\Config\SchemaConfig;

use function DI\create;

/**
Expand Down
19 changes: 11 additions & 8 deletions tests/src/Console/Command/Schema/RenderCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,28 @@ public function testRender(): void
$commandTester = new CommandTester($this->container->get(RenderCommand::class));
$exitCode = $commandTester->execute(['-nc' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE]);
$realOutput = $commandTester->getDisplay();
$expectedOutput = [
'[customer] :: default.customers',
'Entity:', Customer::class,
$articlesOutput = [
'[article] :: default.articles',
'Entity:', Article::class,
'Mapper:', Mapper::class,
'Repository:', Repository::class,
'Primary key:', 'id',
'Fields', '(property -> db.field -> typecast)', 'id -> id -> int', 'name -> name',
'Fields', '(property -> db.field -> typecast)', 'id -> id -> int', 'title -> title', 'description -> description',
'Relations:', 'not defined',
];

'[article] :: default.articles',
'Entity:', Article::class,
$customersOutput = [
'[customer] :: default.customers',
'Entity:', Customer::class,
'Mapper:', Mapper::class,
'Repository:', Repository::class,
'Primary key:', 'id',
'Fields', '(property -> db.field -> typecast)', 'id -> id -> int', 'title -> title', 'description -> description',
'Fields', '(property -> db.field -> typecast)', 'id -> id -> int', 'name -> name',
'Relations:', 'not defined',
];

$this->assertSame(Command::SUCCESS, $exitCode);
$this->assertThat($expectedOutput, new SeeInOrder($realOutput));
$this->assertThat($articlesOutput, new SeeInOrder($realOutput));
$this->assertThat($customersOutput, new SeeInOrder($realOutput));
}
}
9 changes: 3 additions & 6 deletions tests/src/Constraints/SeeInOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
namespace Wakebit\CycleBridge\Tests\Constraints;

use PHPUnit\Framework\Constraint\Constraint;
use ReflectionClass;
use function mb_strlen;
use function mb_strpos;

final class SeeInOrder extends Constraint
{
Expand Down Expand Up @@ -42,15 +39,15 @@ public function matches($values): bool
continue;
}

$valuePosition = mb_strpos($this->content, $value, $position);
$valuePosition = \mb_strpos($this->content, $value, $position);

if ($valuePosition === false || $valuePosition < $position) {
$this->failedValue = $value;

return false;
}

$position = $valuePosition + mb_strlen($value);
$position = $valuePosition + \mb_strlen($value);
}

return true;
Expand All @@ -75,6 +72,6 @@ public function failureDescription($values): string
*/
public function toString(): string
{
return (new ReflectionClass($this))->name;
return (new \ReflectionClass($this))->name;
}
}
1 change: 1 addition & 0 deletions tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected function setUp(): void

/**
* @var array $definitions
*
* @psalm-suppress MissingFile
*/
$definitions = require __DIR__ . '/../config/container.php';
Expand Down

0 comments on commit a970f48

Please sign in to comment.