From be4fd74f4673eb160ed43f4190e106894cc9f085 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 13 Dec 2024 19:27:23 +0400 Subject: [PATCH 1/4] Update metafiles --- .editorconfig | 21 ++++++++++ .gitattributes | 11 ++--- .github/FUNDING.yml | 3 ++ .gitignore | 11 ++--- .php-cs-fixer.dist.php | 13 ++++++ .styleci.yml | 74 ---------------------------------- composer.json | 91 +++++++++++++++++++++++++++--------------- infection.json | 26 ++++++------ phpunit.xml | 21 +++++----- psalm.xml | 5 +-- 10 files changed, 133 insertions(+), 143 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/FUNDING.yml create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .styleci.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..55de6f8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{yml, yaml, sh, conf, neon*}] +indent_size = 2 + +[*.http] +end_of_line = crlf + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes index 3f6e40b..7a91380 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ -/.github export-ignore -/.editorconfig export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/tests export-ignore +/.* export-ignore +/tests export-ignore +/*.xml export-ignore +/*.yml export-ignore +/*.lock export-ignore +/*.dist export-ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0c1e1fa --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: cycle diff --git a/.gitignore b/.gitignore index 55cbc96..898c3b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ -.idea/ -.env +/.*/ +!/.github/ +/runtime/ +/vendor/ composer.lock -vendor/ -*.db -clover.xml -.php_cs.cache -/.phpunit.result.cache diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..45745a1 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,13 @@ +include(__DIR__ . '/src') + ->include(__DIR__ . '/tests') + ->include(__FILE__) + ->cache('./runtime/php-cs-fixer.cache') + ->allowRisky(false) + ->build(); diff --git a/.styleci.yml b/.styleci.yml deleted file mode 100644 index 27df480..0000000 --- a/.styleci.yml +++ /dev/null @@ -1,74 +0,0 @@ -preset: psr12 -risky: true - -version: 8 - -enabled: - - alpha_ordered_traits - - array_indentation - - array_push - - combine_consecutive_issets - - combine_consecutive_unsets - - combine_nested_dirname - - declare_strict_types - - dir_constant - - fully_qualified_strict_types - - function_to_constant - - hash_to_slash_comment - - is_null - - logical_operators - - magic_constant_casing - - magic_method_casing - - method_separation - - modernize_types_casting - - native_function_casing - - native_function_type_declaration_casing - - no_alias_functions - - no_empty_comment - - no_empty_phpdoc - - no_empty_statement - - no_extra_block_blank_lines - - no_short_bool_cast - - no_superfluous_elseif - - no_unneeded_control_parentheses - - no_unneeded_curly_braces - - no_unneeded_final_method - - no_unset_cast - - no_unused_imports - - no_unused_lambda_imports - - no_useless_else - - no_useless_return - - normalize_index_brace - - php_unit_dedicate_assert - - php_unit_dedicate_assert_internal_type - - php_unit_expectation - - php_unit_mock - - php_unit_mock_short_will_return - - php_unit_namespaced - - php_unit_no_expectation_annotation - - phpdoc_no_empty_return - - phpdoc_no_useless_inheritdoc - - phpdoc_order - - phpdoc_property - - phpdoc_scalar - - phpdoc_separation - - phpdoc_singular_inheritdoc - - phpdoc_trim - - phpdoc_trim_consecutive_blank_line_separation - - phpdoc_type_to_var - - phpdoc_types - - phpdoc_types_order - - print_to_echo - - regular_callable_call - - self_accessor - - self_static_accessor - - set_type_to_cast - - short_array_syntax - - short_list_syntax - - simplified_if_return - - single_quote - - standardize_not_equals - - ternary_to_null_coalescing - - trailing_comma_in_multiline_array - - unalign_double_arrow - - unalign_equals diff --git a/composer.json b/composer.json index 0c2219a..85e415c 100644 --- a/composer.json +++ b/composer.json @@ -1,35 +1,62 @@ { - "name": "cycle/schema-builder", - "type": "library", - "license": "MIT", - "description": "Cycle ORM Schema Builder", - "minimum-stability": "dev", - "prefer-stable": true, - "require": { - "php": ">=8.0", - "cycle/orm": "^2.7", - "cycle/database": "^2.7.1", - "yiisoft/friendly-exception": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "spiral/tokenizer": "^2.8", - "vimeo/psalm": "^5.12", - "symfony/console": "^6.0 || ^7.0" - }, - "autoload": { - "psr-4": { - "Cycle\\Schema\\": "src/" + "name": "cycle/schema-builder", + "type": "library", + "license": "MIT", + "description": "Cycle ORM Schema Builder", + "minimum-stability": "dev", + "prefer-stable": true, + "authors": [ + { + "name": "Anton Titov (wolfy-j)", + "email": "wolfy-j@spiralscout.com" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "email": "alexey.gagarin@spiralscout.com" + }, + { + "name": "Pavel Butchnev (butschster)", + "email": "pavel.buchnev@spiralscout.com" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + } + ], + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/cycle" + } + ], + "require": { + "php": ">=8.0", + "cycle/orm": "^2.7", + "cycle/database": "^2.7.1", + "yiisoft/friendly-exception": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "spiral/tokenizer": "^2.8", + "vimeo/psalm": "^5.12", + "symfony/console": "^6.0 || ^7.0", + "spiral/code-style": "^2.2" + }, + "autoload": { + "psr-4": { + "Cycle\\Schema\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Cycle\\Schema\\Tests\\": "tests/Schema/" + } + }, + "scripts": { + "cs:diff": "php-cs-fixer fix --dry-run -v --diff", + "cs:fix": "php-cs-fixer fix -v", + "psalm": "psalm", + "psalm:baseline": "psalm --set-baseline=psalm-baseline.xml", + "test": "phpunit --color=always" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.9.x-dev" - } - }, - "autoload-dev": { - "psr-4": { - "Cycle\\Schema\\Tests\\": "tests/Schema/" - } - } } diff --git a/infection.json b/infection.json index aa27721..57d6912 100644 --- a/infection.json +++ b/infection.json @@ -1,14 +1,14 @@ { - "timeout": 10, - "source": { - "directories": [ - "src" - ] - }, - "logs": { - "text": "infection.log" - }, - "mutators": { - "@default": true - } -} \ No newline at end of file + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "infection.log" + }, + "mutators": { + "@default": true + } +} diff --git a/phpunit.xml b/phpunit.xml index 85ca7a4..125c443 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,8 @@ - + stopOnError="false" +> + + + src/ + + ./tests/ - - - - src - - - \ No newline at end of file + diff --git a/psalm.xml b/psalm.xml index 3f8c055..ff8743a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,11 +1,10 @@ From 94fc28b9c5d2390f33e66876a806a3c6b859866f Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 13 Dec 2024 19:29:02 +0400 Subject: [PATCH 2/4] Apply code style --- psalm-baseline.xml | 412 ++++++++++++++++++ src/Compiler.php | 17 +- src/Defaults.php | 5 +- src/Definition/Comparator/FieldComparator.php | 9 +- src/Definition/Entity.php | 68 +-- src/Definition/Field.php | 15 +- src/Definition/Inheritance.php | 4 +- src/Definition/Inheritance/JoinedTable.php | 5 +- src/Definition/Inheritance/SingleTable.php | 1 + src/Definition/Map/FieldMap.php | 42 +- src/Definition/Map/ForeignKeyMap.php | 22 +- src/Definition/Map/OptionMap.php | 5 - src/Definition/Map/RelationMap.php | 19 +- src/Definition/Relation.php | 47 +- src/Exception/ColumnException.php | 4 +- src/Exception/CompilerException.php | 4 +- src/Exception/EntityException.php | 4 +- src/Exception/FieldException.php | 4 +- src/Exception/OptionException.php | 4 +- src/Exception/RegistryException.php | 4 +- src/Exception/RelationException.php | 4 +- src/Exception/SchemaException.php | 4 +- src/Exception/SchemaModifierException.php | 4 +- src/Exception/SyncException.php | 4 +- ...DiscriminatorColumnNotPresentException.php | 6 +- .../WrongDiscriminatorColumnException.php | 6 +- .../WrongParentKeyColumnException.php | 6 +- src/Exception/TableInheritanceException.php | 4 +- src/Generator/GenerateModifiers.php | 2 +- src/Generator/GenerateRelations.php | 69 +-- src/Generator/GenerateTypecast.php | 8 - src/Generator/PrintChanges.php | 3 +- src/Generator/RenderModifiers.php | 2 +- src/Generator/RenderRelations.php | 9 - src/Generator/ResetTables.php | 5 - src/Generator/ResolveInterfaces.php | 9 - src/Generator/SyncTables.php | 7 - src/Generator/ValidateEntities.php | 4 +- src/GeneratorInterface.php | 3 - src/InversableInterface.php | 4 - src/Registry.php | 11 +- src/Relation/BelongsTo.php | 17 +- src/Relation/Embedded.php | 6 - src/Relation/HasMany.php | 17 +- src/Relation/HasOne.php | 15 +- src/Relation/ManyToMany.php | 24 +- src/Relation/Morphed/BelongsToMorphed.php | 20 +- src/Relation/Morphed/MorphedHasMany.php | 5 +- src/Relation/Morphed/MorphedHasOne.php | 5 +- src/Relation/OptionSchema.php | 34 +- src/Relation/RefersTo.php | 4 +- src/Relation/RelationSchema.php | 2 +- src/Relation/Traits/FieldTrait.php | 24 +- src/Relation/Traits/ForeignKeyTrait.php | 4 +- src/Relation/Traits/MorphTrait.php | 14 +- src/RelationInterface.php | 2 +- src/SchemaModifierInterface.php | 2 - src/Table/Column.php | 70 +-- tests/Schema/BaseTest.php | 85 ++-- tests/Schema/ColumnTest.php | 3 - tests/Schema/CompilerTest.php | 60 +-- tests/Schema/DefaultsTest.php | 102 ++--- .../JoinedTableInheritanceTest.php | 6 +- .../SingleTableInheritanceTest.php | 10 +- ...riminatorColumnNotPresentExceptionTest.php | 4 +- .../WrongDiscriminatorColumnExceptionTest.php | 4 +- .../WrongParentKeyColumnExceptionTest.php | 4 +- tests/Schema/Fixtures/Author.php | 8 +- tests/Schema/Fixtures/AuthorInterface.php | 4 +- .../Schema/Fixtures/BrokenSchemaModifier.php | 4 +- tests/Schema/Fixtures/Composite.php | 4 +- tests/Schema/Fixtures/EmbeddedEntity.php | 2 +- tests/Schema/Fixtures/In2.php | 4 +- tests/Schema/Fixtures/MorphedTo.php | 4 +- tests/Schema/Fixtures/ParentInterface.php | 4 +- tests/Schema/Fixtures/Plain.php | 6 +- tests/Schema/Fixtures/Post.php | 8 +- tests/Schema/Fixtures/Tag.php | 8 +- tests/Schema/Fixtures/TagContext.php | 2 +- tests/Schema/Fixtures/TestLogger.php | 1 - tests/Schema/Fixtures/Typecaster.php | 8 +- tests/Schema/Fixtures/User.php | 16 +- .../Generator/GenerateModifiersTest.php | 12 +- .../Generator/GenerateRelationsTest.php | 12 +- tests/Schema/Generator/PrintChangesTest.php | 32 +- .../Schema/Generator/RenderModifiersTest.php | 6 +- .../Schema/Generator/RenderRelationsTest.php | 2 +- tests/Schema/Generator/TableGeneratorTest.php | 4 +- tests/Schema/RegistryTest.php | 12 +- .../BelongsToRelationCompositePKTest.php | 12 +- .../Schema/Relation/BelongsToRelationTest.php | 12 +- tests/Schema/Relation/EmbeddedTest.php | 24 +- .../HasManyRelationCompositePKTest.php | 12 +- tests/Schema/Relation/HasManyRelationTest.php | 14 +- .../HasOneRelationCompositePKTest.php | 18 +- tests/Schema/Relation/HasOneRelationTest.php | 18 +- .../ManyToManyRelationCompositePKTest.php | 24 +- .../Relation/ManyToManyRelationTest.php | 28 +- ...elongsToMorphedRelationCompositePKTest.php | 28 +- .../Morphed/BelongsToMorphedRelationTest.php | 26 +- .../Morphed/MorphedHasManyRelationTest.php | 2 +- .../Schema/Relation/Traits/FieldTraitTest.php | 30 +- tests/bootstrap.php | 8 +- tests/generate.php | 4 +- 104 files changed, 984 insertions(+), 851 deletions(-) create mode 100644 psalm-baseline.xml diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 0000000..6804979 --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + getOuterKey()]]> + + + + + + + + + + + + + ]]> + + + + + column)]]> + type)]]> + + + + + + + + + + + + + + + + + + + + target === null]]> + target === null]]> + type === null]]> + + + + + + + + + entity->getFields()->getNames()]]> + + + + + entity->getFields()->getNames()]]> + + + + + entity->getFields()->getNames()]]> + + + + + + + + + + + getColumns()]]> + getColumns()]]> + + + getColumns()]]> + getColumns()]]> + getColumns()]]> + getColumns()]]> + + + + + + + + + + + + + + + + + + + + + + + reflector->sortedTables()]]> + + + + + + + + + + + + + + + + + + + relations[$entity][$name]]]> + tables[$entity]['database']]]> + tables[$entity]['schema']]]> + tables[$entity]['table']]]> + + + + + + + + + + + + + + + + + + + + + + children[$entity]]]> + relations[$entity]]]> + relations[$entity][$name]]]> + tables[$entity]['database']]]> + tables[$entity]['schema']]]> + tables[$entity]['table']]]> + + + + + options->get(self::INDEX_CREATE)]]> + + + + + + + + + + options->get(self::INDEX_CREATE)]]> + + + + + options->get(self::INDEX_CREATE)]]> + + + + + options->get(Relation::THROUGH_ENTITY)]]> + options->get(self::INDEX_CREATE)]]> + options->get(self::INDEX_CREATE)]]> + + + + + + + + + + + + + + + + + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(RelationSchema::MORPH_KEY_LENGTH)]]> + + + + + + + + + + + + + options->get(Relation::MORPH_KEY)]]> + options->get(Relation::NULLABLE)]]> + options->get(RelationSchema::MORPH_KEY_LENGTH)]]> + + + + + options->get(Relation::MORPH_KEY)]]> + options->get(Relation::NULLABLE)]]> + options->get(RelationSchema::MORPH_KEY_LENGTH)]]> + + + + + + + + + + + + + + + + + + options[$name]]]> + + + + + + + + + + + + + + + + + + + + options->get(self::INDEX_CREATE)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name]]]> + + + + + + + + + + + + + + + + + + getOptions()->get($field)]]> + getOptions()->get($field)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + options->get(Relation::NULLABLE)]]> + + + + + + + + + + + + + + getFields($source, $sourceKey)->getColumnNames()]]> + + + + $columns, + ]]]> + + + + + + + + + + + + + getOptions()->get(RelationSchema::FK_ON_DELETE) ?? $fkAction]]> + + + + + + + + + + + + + + + + + + field->getAttributes())]]> + + + + + + getEnumValues()[0]]]> + + + + + + diff --git a/src/Compiler.php b/src/Compiler.php index 9fd5d5f..648b0d0 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -15,7 +15,6 @@ use Cycle\Schema\Exception\TableInheritance\DiscriminatorColumnNotPresentException; use Cycle\Schema\Exception\TableInheritance\WrongDiscriminatorColumnException; use Cycle\Schema\Exception\TableInheritance\WrongParentKeyColumnException; -use Throwable; final class Compiler { @@ -37,8 +36,8 @@ public function compile(Registry $registry, array $generators = [], array $defau sprintf( 'Invalid generator `%s`. It should implement `%s` interface.', \is_object($generator) ? $generator::class : \var_export($generator, true), - GeneratorInterface::class - ) + GeneratorInterface::class, + ), ); } @@ -126,16 +125,16 @@ private function compute(Registry $registry, Entity $entity): void \assert($modifier instanceof SchemaModifierInterface); try { $modifier->modifySchema($schema); - } catch (Throwable $e) { + } catch (\Throwable $e) { throw new SchemaModifierException( sprintf( 'Unable to apply schema modifier `%s` for the `%s` role. %s', $modifier::class, $role, - $e->getMessage() + $e->getMessage(), ), - (int)$e->getCode(), - $e + (int) $e->getCode(), + $e, ); } } @@ -172,11 +171,11 @@ private function renderColumns(Entity $entity): array } try { $comparator->compare(); - } catch (Throwable $e) { + } catch (\Throwable $e) { throw new Exception\CompilerException(sprintf( "Error compiling the `%s` role.\n\n%s", $entity->getRole() ?? 'unknown', - $e->getMessage() + $e->getMessage(), ), (int) $e->getCode()); } } diff --git a/src/Defaults.php b/src/Defaults.php index 6bb4558..5fe357f 100644 --- a/src/Defaults.php +++ b/src/Defaults.php @@ -24,9 +24,8 @@ public function __construct( SchemaInterface::SOURCE => Source::class, SchemaInterface::SCOPE => null, SchemaInterface::TYPECAST_HANDLER => null, - ] - ) { - } + ], + ) {} /** * @param array $defaults diff --git a/src/Definition/Comparator/FieldComparator.php b/src/Definition/Comparator/FieldComparator.php index ee945a9..3d0f045 100644 --- a/src/Definition/Comparator/FieldComparator.php +++ b/src/Definition/Comparator/FieldComparator.php @@ -5,12 +5,11 @@ namespace Cycle\Schema\Definition\Comparator; use Cycle\Schema\Definition\Field; -use Exception; -use InvalidArgumentException; final class FieldComparator { private $columnName; + /** @var Field[] */ private $fields = []; @@ -20,7 +19,7 @@ public function addField(string $key, Field $field): self $this->columnName = $field->getColumn(); } if ($this->columnName !== $field->getColumn()) { - throw new InvalidArgumentException('The field comparator only accepts fields with the same column name.'); + throw new \InvalidArgumentException('The field comparator only accepts fields with the same column name.'); } $this->fields[$key] = $field; return $this; @@ -33,9 +32,9 @@ public function compare(): void } // Check options if (!$this->compareOptions() || !$this->compareProperties()) { - throw new Exception( + throw new \Exception( "Different definitions are specified for the `$this->columnName` column:" - . "\n\n{$this->generateErrorText()}" + . "\n\n{$this->generateErrorText()}", ); } } diff --git a/src/Definition/Entity.php b/src/Definition/Entity.php index fc60be6..d16e5f3 100644 --- a/src/Definition/Entity.php +++ b/src/Definition/Entity.php @@ -70,15 +70,15 @@ final class Entity private array|string|null $typecast = null; private array $schema = []; - private FieldMap $fields; - private RelationMap $relations; private FieldMap $primaryFields; private array $schemaModifiers = []; private ?Inheritance $inheritance = null; + /** @var class-string|null */ private ?string $stiParent = null; + private ForeignKeyMap $foreignKeys; public function __construct() @@ -90,18 +90,6 @@ public function __construct() $this->foreignKeys = new ForeignKeyMap(); } - /** - * Full entity copy. - */ - public function __clone() - { - $this->options = clone $this->options; - $this->fields = clone $this->fields; - $this->primaryFields = clone $this->primaryFields; - $this->relations = clone $this->relations; - $this->foreignKeys = clone $this->foreignKeys; - } - public function getOptions(): OptionMap { return $this->options; @@ -253,7 +241,7 @@ public function getForeignKeys(): ForeignKeyMap public function addSchemaModifier(SchemaModifierInterface $modifier): self { $this->schemaModifiers[] = $modifier->withRole($this->role ?? throw new EntityException( - 'Entity must have a `role` to be able to add a modifier.' + 'Entity must have a `role` to be able to add a modifier.', )); return $this; @@ -364,25 +352,6 @@ public function getPrimaryFields(): FieldMap return $this->primaryFields; } - /** - * @template T of object - * - * @param class-string|null $class - * - * @return ($class is class-string ? class-string : null) - */ - private function normalizeClass(string $class = null): ?string - { - if ($class === null) { - return null; - } - - /** @var class-string $class */ - $class = \ltrim($class, '\\'); - - return $class; - } - public function setInheritance(Inheritance $inheritance): void { $this->inheritance = $inheritance; @@ -434,4 +403,35 @@ public function setTableName(string $tableName): void { $this->tableName = $tableName; } + + /** + * Full entity copy. + */ + public function __clone() + { + $this->options = clone $this->options; + $this->fields = clone $this->fields; + $this->primaryFields = clone $this->primaryFields; + $this->relations = clone $this->relations; + $this->foreignKeys = clone $this->foreignKeys; + } + + /** + * @template T of object + * + * @param class-string|null $class + * + * @return ($class is class-string ? class-string : null) + */ + private function normalizeClass(?string $class = null): ?string + { + if ($class === null) { + return null; + } + + /** @var class-string $class */ + $class = \ltrim($class, '\\'); + + return $class; + } } diff --git a/src/Definition/Field.php b/src/Definition/Field.php index 8cfd9fb..75d34cf 100644 --- a/src/Definition/Field.php +++ b/src/Definition/Field.php @@ -34,7 +34,6 @@ final class Field private array|string|null $typecast = null; private ?int $generated = null; - private bool $referenced = false; private ?string $entityClass = null; @@ -44,12 +43,6 @@ public function __construct() $this->attributes = new OptionMap(); } - public function __clone() - { - $this->options = clone $this->options; - $this->attributes = clone $this->attributes; - } - public function getOptions(): OptionMap { return $this->options; @@ -105,9 +98,9 @@ public function setColumn(string $column): self } /** + * @return non-empty-string * @throws FieldException * - * @return non-empty-string */ public function getColumn(): string { @@ -179,4 +172,10 @@ public function setEntityClass(?string $entityClass): self return $this; } + + public function __clone() + { + $this->options = clone $this->options; + $this->attributes = clone $this->attributes; + } } diff --git a/src/Definition/Inheritance.php b/src/Definition/Inheritance.php index 30d7aa0..f2f0fb2 100644 --- a/src/Definition/Inheritance.php +++ b/src/Definition/Inheritance.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Definition; -abstract class Inheritance -{ -} +abstract class Inheritance {} diff --git a/src/Definition/Inheritance/JoinedTable.php b/src/Definition/Inheritance/JoinedTable.php index 383617f..2a70ef5 100644 --- a/src/Definition/Inheritance/JoinedTable.php +++ b/src/Definition/Inheritance/JoinedTable.php @@ -11,9 +11,8 @@ final class JoinedTable extends Inheritance { public function __construct( private Entity $parent, - private ?string $outerKey = null - ) { - } + private ?string $outerKey = null, + ) {} public function getOuterKey(): ?string { diff --git a/src/Definition/Inheritance/SingleTable.php b/src/Definition/Inheritance/SingleTable.php index d84698b..78a5f10 100644 --- a/src/Definition/Inheritance/SingleTable.php +++ b/src/Definition/Inheritance/SingleTable.php @@ -10,6 +10,7 @@ final class SingleTable extends Inheritance { /** @var array */ private array $children = []; + private ?string $discriminator = null; /** diff --git a/src/Definition/Map/FieldMap.php b/src/Definition/Map/FieldMap.php index 84251cd..68caf57 100644 --- a/src/Definition/Map/FieldMap.php +++ b/src/Definition/Map/FieldMap.php @@ -6,7 +6,6 @@ use Cycle\Schema\Definition\Field; use Cycle\Schema\Exception\FieldException; -use Traversable; /** * Manage the set of fields associated with the entity. @@ -18,19 +17,6 @@ final class FieldMap implements \IteratorAggregate, \Countable /** @var Field[] */ private $fields = []; - /** - * Cloning. - */ - public function __clone() - { - foreach ($this->fields as $name => $field) { - $this->fields[$name] = clone $field; - } - } - - /** - * @return int - */ public function count(): int { return count($this->fields); @@ -54,11 +40,6 @@ public function getNames(): array return array_keys($this->fields); } - /** - * @param string $name - * - * @return bool - */ public function has(string $name): bool { return isset($this->fields[$name]); @@ -118,12 +99,6 @@ public function getByColumnName(string $name): Field throw new FieldException("Undefined field with column name `{$name}`."); } - /** - * @param string $name - * @param Field $field - * - * @return FieldMap - */ public function set(string $name, Field $field): self { if ($this->has($name)) { @@ -135,19 +110,24 @@ public function set(string $name, Field $field): self return $this; } - /** - * @param string $name - * - * @return FieldMap - */ public function remove(string $name): self { unset($this->fields[$name]); return $this; } - public function getIterator(): Traversable + public function getIterator(): \Traversable { return new \ArrayIterator($this->fields); } + + /** + * Cloning. + */ + public function __clone() + { + foreach ($this->fields as $name => $field) { + $this->fields[$name] = clone $field; + } + } } diff --git a/src/Definition/Map/ForeignKeyMap.php b/src/Definition/Map/ForeignKeyMap.php index 185a610..9af6e7b 100644 --- a/src/Definition/Map/ForeignKeyMap.php +++ b/src/Definition/Map/ForeignKeyMap.php @@ -18,16 +18,6 @@ final class ForeignKeyMap implements \IteratorAggregate, \Countable */ private array $foreignKeys = []; - /** - * Cloning. - */ - public function __clone() - { - foreach ($this->foreignKeys as $index => $foreignKey) { - $this->foreignKeys[$index] = clone $foreignKey; - } - } - public function has(ForeignKey $foreignKey): bool { return isset($this->foreignKeys[$this->generateIdentifier($foreignKey)]); @@ -57,6 +47,16 @@ public function getIterator(): \Traversable return new \ArrayIterator($this->foreignKeys); } + /** + * Cloning. + */ + public function __clone() + { + foreach ($this->foreignKeys as $index => $foreignKey) { + $this->foreignKeys[$index] = clone $foreignKey; + } + } + /** * @return non-empty-string */ @@ -66,7 +66,7 @@ private function generateIdentifier(ForeignKey $foreignKey): string '%s:%s:%s', $foreignKey->getTarget(), \implode(',', $foreignKey->getInnerColumns()), - \implode(',', $foreignKey->getOuterColumns()) + \implode(',', $foreignKey->getOuterColumns()), ); } } diff --git a/src/Definition/Map/OptionMap.php b/src/Definition/Map/OptionMap.php index 81de785..802a869 100644 --- a/src/Definition/Map/OptionMap.php +++ b/src/Definition/Map/OptionMap.php @@ -13,11 +13,6 @@ final class OptionMap implements \IteratorAggregate { private array $options = []; - /** - * @param string $name - * - * @return bool - */ public function has(string $name): bool { return array_key_exists($name, $this->options); diff --git a/src/Definition/Map/RelationMap.php b/src/Definition/Map/RelationMap.php index 1e17256..9407685 100644 --- a/src/Definition/Map/RelationMap.php +++ b/src/Definition/Map/RelationMap.php @@ -6,7 +6,6 @@ use Cycle\Schema\Definition\Relation; use Cycle\Schema\Exception\RelationException; -use Traversable; /** * @implements \IteratorAggregate @@ -16,13 +15,6 @@ final class RelationMap implements \IteratorAggregate /** @var array */ private array $relations = []; - public function __clone() - { - foreach ($this->relations as $name => $relation) { - $this->relations[$name] = clone $relation; - } - } - public function has(string $name): bool { return isset($this->relations[$name]); @@ -55,10 +47,17 @@ public function remove(string $name): self } /** - * @return Traversable + * @return \Traversable */ - public function getIterator(): Traversable + public function getIterator(): \Traversable { return new \ArrayIterator($this->relations); } + + public function __clone() + { + foreach ($this->relations as $name => $relation) { + $this->relations[$name] = clone $relation; + } + } } diff --git a/src/Definition/Relation.php b/src/Definition/Relation.php index f45eeb1..b8fc1a4 100644 --- a/src/Definition/Relation.php +++ b/src/Definition/Relation.php @@ -35,27 +35,11 @@ public function __construct() $this->options = new OptionMap(); } - /** - * Cloning. - */ - public function __clone() - { - $this->options = clone $this->options; - } - - /** - * @return OptionMap - */ public function getOptions(): OptionMap { return $this->options; } - /** - * @param string $type - * - * @return Relation - */ public function setType(string $type): self { $this->type = $type; @@ -63,9 +47,6 @@ public function setType(string $type): self return $this; } - /** - * @return string - */ public function getType(): string { if ($this->type === null) { @@ -78,7 +59,6 @@ public function getType(): string /** * @param non-empty-string $target * - * @return Relation */ public function setTarget(string $target): self { @@ -99,13 +79,6 @@ public function getTarget(): string return $this->target; } - /** - * @param string $into - * @param string $as - * @param int $load - * - * @return Relation - */ public function setInverse(string $into, string $as, ?int $load = null): self { $this->inverse = $into; @@ -115,35 +88,31 @@ public function setInverse(string $into, string $as, ?int $load = null): self return $this; } - /** - * @return bool - */ public function isInversed(): bool { return $this->inverse !== null; } - /** - * @return string|null - */ public function getInverseName(): ?string { return $this->inverse; } - /** - * @return string|null - */ public function getInverseType(): ?string { return $this->inverseType; } - /** - * @return int|null - */ public function getInverseLoad(): ?int { return $this->inverseLoad; } + + /** + * Cloning. + */ + public function __clone() + { + $this->options = clone $this->options; + } } diff --git a/src/Exception/ColumnException.php b/src/Exception/ColumnException.php index f19d304..e8ba706 100644 --- a/src/Exception/ColumnException.php +++ b/src/Exception/ColumnException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class ColumnException extends RegistryException -{ -} +class ColumnException extends RegistryException {} diff --git a/src/Exception/CompilerException.php b/src/Exception/CompilerException.php index 55e2c55..b7d2169 100644 --- a/src/Exception/CompilerException.php +++ b/src/Exception/CompilerException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class CompilerException extends \RuntimeException -{ -} +class CompilerException extends \RuntimeException {} diff --git a/src/Exception/EntityException.php b/src/Exception/EntityException.php index 16d3a82..0398c86 100644 --- a/src/Exception/EntityException.php +++ b/src/Exception/EntityException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class EntityException extends \RuntimeException -{ -} +class EntityException extends \RuntimeException {} diff --git a/src/Exception/FieldException.php b/src/Exception/FieldException.php index 9675f12..9b803ba 100644 --- a/src/Exception/FieldException.php +++ b/src/Exception/FieldException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class FieldException extends RegistryException -{ -} +class FieldException extends RegistryException {} diff --git a/src/Exception/OptionException.php b/src/Exception/OptionException.php index b4c6c7a..aacbebc 100644 --- a/src/Exception/OptionException.php +++ b/src/Exception/OptionException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class OptionException extends RegistryException -{ -} +class OptionException extends RegistryException {} diff --git a/src/Exception/RegistryException.php b/src/Exception/RegistryException.php index 0412450..e2cab0c 100644 --- a/src/Exception/RegistryException.php +++ b/src/Exception/RegistryException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class RegistryException extends \RuntimeException -{ -} +class RegistryException extends \RuntimeException {} diff --git a/src/Exception/RelationException.php b/src/Exception/RelationException.php index 06bb082..e6caae9 100644 --- a/src/Exception/RelationException.php +++ b/src/Exception/RelationException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class RelationException extends SchemaModifierException -{ -} +class RelationException extends SchemaModifierException {} diff --git a/src/Exception/SchemaException.php b/src/Exception/SchemaException.php index 0d23bac..528f0c3 100644 --- a/src/Exception/SchemaException.php +++ b/src/Exception/SchemaException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class SchemaException extends \RuntimeException -{ -} +class SchemaException extends \RuntimeException {} diff --git a/src/Exception/SchemaModifierException.php b/src/Exception/SchemaModifierException.php index 778ad17..13eef4d 100644 --- a/src/Exception/SchemaModifierException.php +++ b/src/Exception/SchemaModifierException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class SchemaModifierException extends RegistryException -{ -} +class SchemaModifierException extends RegistryException {} diff --git a/src/Exception/SyncException.php b/src/Exception/SyncException.php index 17090bc..4346f4f 100644 --- a/src/Exception/SyncException.php +++ b/src/Exception/SyncException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class SyncException extends \RuntimeException -{ -} +class SyncException extends \RuntimeException {} diff --git a/src/Exception/TableInheritance/DiscriminatorColumnNotPresentException.php b/src/Exception/TableInheritance/DiscriminatorColumnNotPresentException.php index 5e1c39d..f9578ae 100644 --- a/src/Exception/TableInheritance/DiscriminatorColumnNotPresentException.php +++ b/src/Exception/TableInheritance/DiscriminatorColumnNotPresentException.php @@ -14,7 +14,7 @@ public function __construct(private Entity $entity) { parent::__construct(sprintf( 'Discriminator column for the `%s` role should be defined.', - (string)($this->entity->getRole() ?? $this->entity->getClass()) + (string) ($this->entity->getRole() ?? $this->entity->getClass()), )); } @@ -30,8 +30,8 @@ public function getSolution(): ?string return sprintf( "Discriminator column is required for Single Table Inheritance schema.\n" . 'You have to specify one of the defined fields of the `%s` role: `%s`', - (string)($this->entity->getRole() ?? $this->entity->getClass()), - $fields + (string) ($this->entity->getRole() ?? $this->entity->getClass()), + $fields, ); } } diff --git a/src/Exception/TableInheritance/WrongDiscriminatorColumnException.php b/src/Exception/TableInheritance/WrongDiscriminatorColumnException.php index 2b9860d..7aaa88e 100644 --- a/src/Exception/TableInheritance/WrongDiscriminatorColumnException.php +++ b/src/Exception/TableInheritance/WrongDiscriminatorColumnException.php @@ -15,7 +15,7 @@ public function __construct(private Entity $entity, string $discriminatorColumn) parent::__construct(sprintf( 'Discriminator column `%s` is not found among fields of the `%s` role.', $discriminatorColumn, - (string)($this->entity->getRole() ?? $this->entity->getClass()) + (string) ($this->entity->getRole() ?? $this->entity->getClass()), )); } @@ -30,8 +30,8 @@ public function getSolution(): ?string return sprintf( 'You have to specify one of the defined fields of the `%s` role: `%s`', - (string)($this->entity->getRole() ?? $this->entity->getClass()), - $fields + (string) ($this->entity->getRole() ?? $this->entity->getClass()), + $fields, ); } } diff --git a/src/Exception/TableInheritance/WrongParentKeyColumnException.php b/src/Exception/TableInheritance/WrongParentKeyColumnException.php index ba14b34..e532209 100644 --- a/src/Exception/TableInheritance/WrongParentKeyColumnException.php +++ b/src/Exception/TableInheritance/WrongParentKeyColumnException.php @@ -15,7 +15,7 @@ public function __construct(private Entity $entity, string $outerKey) parent::__construct(sprintf( 'Outer key column `%s` is not found among fields of the `%s` role.', $outerKey, - (string)($this->entity->getRole() ?? $this->entity->getClass()) + (string) ($this->entity->getRole() ?? $this->entity->getClass()), )); } @@ -30,8 +30,8 @@ public function getSolution(): ?string return sprintf( 'You have to specify one of the defined fields of the `%s` role: `%s`', - (string)($this->entity->getRole() ?? $this->entity->getClass()), - $fields + (string) ($this->entity->getRole() ?? $this->entity->getClass()), + $fields, ); } } diff --git a/src/Exception/TableInheritanceException.php b/src/Exception/TableInheritanceException.php index 853b35e..05d9a49 100644 --- a/src/Exception/TableInheritanceException.php +++ b/src/Exception/TableInheritanceException.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Exception; -class TableInheritanceException extends CompilerException -{ -} +class TableInheritanceException extends CompilerException {} diff --git a/src/Generator/GenerateModifiers.php b/src/Generator/GenerateModifiers.php index 607b9e0..6090b23 100644 --- a/src/Generator/GenerateModifiers.php +++ b/src/Generator/GenerateModifiers.php @@ -37,7 +37,7 @@ protected function register(Registry $registry, Entity $entity): void throw new SchemaException( sprintf('Unable to compute modifier `%s` for the `%s` role.', $modifier::class, $role), $e->getCode(), - $e + $e, ); } } diff --git a/src/Generator/GenerateRelations.php b/src/Generator/GenerateRelations.php index e44e448..52bbc8a 100644 --- a/src/Generator/GenerateRelations.php +++ b/src/Generator/GenerateRelations.php @@ -57,11 +57,7 @@ final class GenerateRelations implements GeneratorInterface /** @var RelationInterface[] */ private $relations = []; - /** - * @param array|null $relations - * @param OptionSchema|null $optionSchema - */ - public function __construct(array $relations = null, OptionSchema $optionSchema = null) + public function __construct(?array $relations = null, ?OptionSchema $optionSchema = null) { $relations = $relations ?? self::getDefaultRelations(); $this->options = $optionSchema ?? new OptionSchema(self::OPTION_MAP); @@ -71,8 +67,8 @@ public function __construct(array $relations = null, OptionSchema $optionSchema throw new \InvalidArgumentException( sprintf( 'Invalid relation type, RelationInterface excepted, `%s` given', - is_object($relation) ? get_class($relation) : gettype($relation) - ) + is_object($relation) ? get_class($relation) : gettype($relation), + ), ); } @@ -80,11 +76,6 @@ public function __construct(array $relations = null, OptionSchema $optionSchema } } - /** - * @param Registry $registry - * - * @return Registry - */ public function run(Registry $registry): Registry { foreach ($registry as $entity) { @@ -98,10 +89,21 @@ public function run(Registry $registry): Registry return $registry; } - /** - * @param Registry $registry - * @param Entity $entity - */ + protected static function getDefaultRelations(): array + { + return [ + 'embedded' => new Definition\Embedded(), + 'belongsTo' => new Definition\BelongsTo(), + 'hasOne' => new Definition\HasOne(), + 'hasMany' => new Definition\HasMany(), + 'refersTo' => new Definition\RefersTo(), + 'manyToMany' => new Definition\ManyToMany(), + 'belongsToMorphed' => new Definition\Morphed\BelongsToMorphed(), + 'morphedHasOne' => new Definition\Morphed\MorphedHasOne(), + 'morphedHasMany' => new Definition\Morphed\MorphedHasMany(), + ]; + } + protected function register(Registry $registry, Entity $entity): void { $role = $entity->getRole(); @@ -112,7 +114,7 @@ protected function register(Registry $registry, Entity $entity): void $name, $role, $r->getTarget(), - $this->options->withOptions($r->getOptions()) + $this->options->withOptions($r->getOptions()), ); // compute relation values (field names, related entities and etc) @@ -122,7 +124,7 @@ protected function register(Registry $registry, Entity $entity): void throw new SchemaException( "Unable to compute relation `{$role}`.`{$name}`", $e->getCode(), - $e + $e, ); } @@ -130,10 +132,6 @@ protected function register(Registry $registry, Entity $entity): void } } - /** - * @param Registry $registry - * @param Entity $entity - */ protected function inverse(Registry $registry, Entity $entity): void { foreach ($entity->getRelations() as $name => $r) { @@ -155,7 +153,7 @@ protected function inverse(Registry $registry, Entity $entity): void $inversed = $schema->inverseRelation( $this->initRelation($inverseType), $inverseName, - $r->getInverseLoad() + $r->getInverseLoad(), ); $registry->registerRelation($target, $inverseName, $inversed); @@ -163,18 +161,13 @@ protected function inverse(Registry $registry, Entity $entity): void throw new SchemaException( "Unable to inverse relation `{$entity->getRole()}`.`{$name}`", $e->getCode(), - $e + $e, ); } } } } - /** - * @param string $type - * - * @return RelationInterface - */ protected function initRelation(string $type): RelationInterface { if (!isset($this->relations[$type])) { @@ -183,22 +176,4 @@ protected function initRelation(string $type): RelationInterface return $this->relations[$type]; } - - /** - * @return array - */ - protected static function getDefaultRelations(): array - { - return [ - 'embedded' => new Definition\Embedded(), - 'belongsTo' => new Definition\BelongsTo(), - 'hasOne' => new Definition\HasOne(), - 'hasMany' => new Definition\HasMany(), - 'refersTo' => new Definition\RefersTo(), - 'manyToMany' => new Definition\ManyToMany(), - 'belongsToMorphed' => new Definition\Morphed\BelongsToMorphed(), - 'morphedHasOne' => new Definition\Morphed\MorphedHasOne(), - 'morphedHasMany' => new Definition\Morphed\MorphedHasMany(), - ]; - } } diff --git a/src/Generator/GenerateTypecast.php b/src/Generator/GenerateTypecast.php index 58a88fc..1d83069 100644 --- a/src/Generator/GenerateTypecast.php +++ b/src/Generator/GenerateTypecast.php @@ -14,11 +14,6 @@ */ final class GenerateTypecast implements GeneratorInterface { - /** - * @param Registry $registry - * - * @return Registry - */ public function run(Registry $registry): Registry { foreach ($registry as $entity) { @@ -31,8 +26,6 @@ public function run(Registry $registry): Registry /** * Automatically clarify column types based on table column types. * - * @param Registry $registry - * @param Entity $entity */ protected function compute(Registry $registry, Entity $entity): void { @@ -54,7 +47,6 @@ protected function compute(Registry $registry, Entity $entity): void } /** - * @param AbstractColumn $column * * @return callable-array|string|null */ diff --git a/src/Generator/PrintChanges.php b/src/Generator/PrintChanges.php index 3c1227e..f3fa6c6 100644 --- a/src/Generator/PrintChanges.php +++ b/src/Generator/PrintChanges.php @@ -16,8 +16,7 @@ final class PrintChanges implements GeneratorInterface public function __construct( private OutputInterface $output, - ) { - } + ) {} public function run(Registry $registry): Registry { diff --git a/src/Generator/RenderModifiers.php b/src/Generator/RenderModifiers.php index e55c657..9f56155 100644 --- a/src/Generator/RenderModifiers.php +++ b/src/Generator/RenderModifiers.php @@ -37,7 +37,7 @@ protected function register(Registry $registry, Entity $entity): void throw new SchemaException( sprintf('Unable to render modifier `%s` for the `%s` role.', $modifier::class, $role), $e->getCode(), - $e + $e, ); } } diff --git a/src/Generator/RenderRelations.php b/src/Generator/RenderRelations.php index eb37f06..75f8bfb 100644 --- a/src/Generator/RenderRelations.php +++ b/src/Generator/RenderRelations.php @@ -13,11 +13,6 @@ */ final class RenderRelations implements GeneratorInterface { - /** - * @param Registry $registry - * - * @return Registry - */ public function run(Registry $registry): Registry { foreach ($registry as $entity) { @@ -27,10 +22,6 @@ public function run(Registry $registry): Registry return $registry; } - /** - * @param Registry $registry - * @param Entity $entity - */ protected function compute(Registry $registry, Entity $entity): void { foreach ($registry->getRelations($entity) as $relation) { diff --git a/src/Generator/ResetTables.php b/src/Generator/ResetTables.php index dfd8a30..95f92dc 100644 --- a/src/Generator/ResetTables.php +++ b/src/Generator/ResetTables.php @@ -12,11 +12,6 @@ */ final class ResetTables implements GeneratorInterface { - /** - * @param Registry $registry - * - * @return Registry - */ public function run(Registry $registry): Registry { foreach ($registry as $entity) { diff --git a/src/Generator/ResolveInterfaces.php b/src/Generator/ResolveInterfaces.php index 6cc9d0c..2085cb2 100644 --- a/src/Generator/ResolveInterfaces.php +++ b/src/Generator/ResolveInterfaces.php @@ -15,11 +15,6 @@ final class ResolveInterfaces implements GeneratorInterface // option to indicate that static link resolution is required public const STATIC_LINK = 'staticLink'; - /** - * @param Registry $registry - * - * @return Registry - */ public function run(Registry $registry): Registry { foreach ($registry as $entity) { @@ -30,8 +25,6 @@ public function run(Registry $registry): Registry } /** - * @param Registry $registry - * @param Entity $entity * * @throws RelationException */ @@ -54,8 +47,6 @@ protected function compute(Registry $registry, Entity $entity): void } /** - * @param Registry $registry - * @param string $target * * @return non-empty-string */ diff --git a/src/Generator/SyncTables.php b/src/Generator/SyncTables.php index 354ba85..d1a3989 100644 --- a/src/Generator/SyncTables.php +++ b/src/Generator/SyncTables.php @@ -18,11 +18,9 @@ final class SyncTables implements GeneratorInterface public const READONLY_SCHEMA = 'readonlySchema'; /** - * @param Registry $registry * * @throws SyncException * - * @return Registry */ public function run(Registry $registry): Registry { @@ -51,11 +49,6 @@ public function run(Registry $registry): Registry return $registry; } - /** - * @param Registry $registry - * - * @return array - */ private function getRegistryDbList(Registry $registry): array { $databases = []; diff --git a/src/Generator/ValidateEntities.php b/src/Generator/ValidateEntities.php index f4cf4c6..6743237 100644 --- a/src/Generator/ValidateEntities.php +++ b/src/Generator/ValidateEntities.php @@ -11,18 +11,16 @@ final class ValidateEntities implements GeneratorInterface { /** - * @param Registry $registry * * @throws EntityException * - * @return Registry */ public function run(Registry $registry): Registry { foreach ($registry->getIterator() as $entity) { if (count($entity->getFields()) === 0) { throw new EntityException( - "Entity `{$entity->getRole()}` is empty" + "Entity `{$entity->getRole()}` is empty", ); } } diff --git a/src/GeneratorInterface.php b/src/GeneratorInterface.php index ee3cb28..e7831bd 100644 --- a/src/GeneratorInterface.php +++ b/src/GeneratorInterface.php @@ -9,9 +9,6 @@ interface GeneratorInterface /** * Run generator over given registry. * - * @param Registry $registry - * - * @return Registry */ public function run(Registry $registry): Registry; } diff --git a/src/InversableInterface.php b/src/InversableInterface.php index 258a105..3dcf448 100644 --- a/src/InversableInterface.php +++ b/src/InversableInterface.php @@ -14,8 +14,6 @@ interface InversableInterface extends RelationInterface /** * Return all targets to which relation must be inversed to. * - * @param Registry $registry - * * @return Entity[] */ public function inverseTargets(Registry $registry): array; @@ -23,11 +21,9 @@ public function inverseTargets(Registry $registry): array; /** * Inverse relation options into given schema. * - * @param RelationInterface $relation * @param string $into Target relation name. * @param int|null $load Target relation pre-load method (null, EAGER, PROMISE) * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface; } diff --git a/src/Registry.php b/src/Registry.php index 5731aac..a65d7f4 100644 --- a/src/Registry.php +++ b/src/Registry.php @@ -10,7 +10,6 @@ use Cycle\Database\DatabaseProviderInterface; use Cycle\Database\Exception\DBALException; use Cycle\Database\Schema\AbstractTable; -use Traversable; /** * @implements \IteratorAggregate @@ -19,15 +18,13 @@ final class Registry implements \IteratorAggregate { /** @var Entity[] */ private array $entities = []; + private DatabaseProviderInterface $dbal; private \SplObjectStorage $tables; private \SplObjectStorage $children; private \SplObjectStorage $relations; private Defaults $defaults; - /** - * @param DatabaseProviderInterface $dbal - */ public function __construct(DatabaseProviderInterface $dbal, ?Defaults $defaults = null) { $this->dbal = $dbal; @@ -85,7 +82,7 @@ public function getEntity(string $role): Entity throw new RegistryException("Undefined entity `{$role}`"); } - public function getIterator(): Traversable + public function getIterator(): \Traversable { return new \ArrayIterator($this->entities); } @@ -161,7 +158,7 @@ public function linkTable(Entity $entity, ?string $database, string $table): sel } } - if (null === $schema) { + if ($schema === null) { $dbTable = $this->dbal->database($database)->table($table); if (!\method_exists($dbTable, 'getSchema')) { throw new RegistryException('Unable to retrieve table schema.'); @@ -203,9 +200,9 @@ public function getDatabase(Entity $entity): string } /** + * @return non-empty-string * @throws RegistryException * - * @return non-empty-string */ public function getTable(Entity $entity): string { diff --git a/src/Relation/BelongsTo.php b/src/Relation/BelongsTo.php index 0a5a36d..c78d15f 100644 --- a/src/Relation/BelongsTo.php +++ b/src/Relation/BelongsTo.php @@ -45,9 +45,6 @@ final class BelongsTo extends RelationSchema implements InversableInterface RelationSchema::FK_ON_DELETE => null, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { parent::compute($registry); @@ -62,13 +59,10 @@ public function compute(Registry $registry): void $target, Relation::OUTER_KEY, $source, - Relation::INNER_KEY + Relation::INNER_KEY, ); } - /** - * @param Registry $registry - */ public function render(Registry $registry): void { $source = $registry->getEntity($this->source); @@ -90,13 +84,12 @@ public function render(Registry $registry): void $source, $outerFields, $innerFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); } } /** - * @param Registry $registry * * @return Entity[] */ @@ -108,13 +101,9 @@ public function inverseTargets(Registry $registry): array } /** - * @param RelationInterface $relation - * @param string $into - * @param int|null $load * * @throws RelationException * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface { @@ -130,7 +119,7 @@ public function inverseRelation(RelationInterface $relation, string $into, ?int Relation::LOAD => $load, Relation::INNER_KEY => $this->options->get(Relation::OUTER_KEY), Relation::OUTER_KEY => $this->options->get(Relation::INNER_KEY), - ]) + ]), ); } } diff --git a/src/Relation/Embedded.php b/src/Relation/Embedded.php index 0f2fad5..1b397bc 100644 --- a/src/Relation/Embedded.php +++ b/src/Relation/Embedded.php @@ -22,9 +22,6 @@ final class Embedded extends RelationSchema self::EMBEDDED_PREFIX => '', ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { $source = $registry->getEntity($this->source); @@ -68,9 +65,6 @@ public function compute(Registry $registry): void parent::compute($registry); } - /** - * @param Registry $registry - */ public function render(Registry $registry): void { // relation does not require any column rendering besides actual tables diff --git a/src/Relation/HasMany.php b/src/Relation/HasMany.php index a041030..42ce59e 100644 --- a/src/Relation/HasMany.php +++ b/src/Relation/HasMany.php @@ -54,9 +54,6 @@ final class HasMany extends RelationSchema implements InversableInterface RelationSchema::FK_ON_DELETE => null, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { parent::compute($registry); @@ -71,13 +68,10 @@ public function compute(Registry $registry): void $source, Relation::INNER_KEY, $target, - Relation::OUTER_KEY + Relation::OUTER_KEY, ); } - /** - * @param Registry $registry - */ public function render(Registry $registry): void { $source = $registry->getEntity($this->source); @@ -99,13 +93,12 @@ public function render(Registry $registry): void $target, $innerFields, $outerFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); } } /** - * @param Registry $registry * * @return Entity[] */ @@ -117,13 +110,9 @@ public function inverseTargets(Registry $registry): array } /** - * @param RelationInterface $relation - * @param string $into - * @param int|null $load * * @throws RelationException * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface { @@ -143,7 +132,7 @@ public function inverseRelation(RelationInterface $relation, string $into, ?int Relation::LOAD => $load, Relation::INNER_KEY => $this->options->get(Relation::OUTER_KEY), Relation::OUTER_KEY => $this->options->get(Relation::INNER_KEY), - ]) + ]), ); } } diff --git a/src/Relation/HasOne.php b/src/Relation/HasOne.php index f01fe70..9a94c46 100644 --- a/src/Relation/HasOne.php +++ b/src/Relation/HasOne.php @@ -45,9 +45,6 @@ final class HasOne extends RelationSchema implements InversableInterface RelationSchema::FK_ON_DELETE => null, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { parent::compute($registry); @@ -66,9 +63,6 @@ public function compute(Registry $registry): void ); } - /** - * @param Registry $registry - */ public function render(Registry $registry): void { $source = $registry->getEntity($this->source); @@ -90,13 +84,12 @@ public function render(Registry $registry): void $target, $innerFields, $outerFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); } } /** - * @param Registry $registry * * @return Entity[] */ @@ -108,13 +101,9 @@ public function inverseTargets(Registry $registry): array } /** - * @param RelationInterface $relation - * @param string $into - * @param int|null $load * * @throws RelationException * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface { @@ -130,7 +119,7 @@ public function inverseRelation(RelationInterface $relation, string $into, ?int Relation::LOAD => $load, Relation::INNER_KEY => $this->options->get(Relation::OUTER_KEY), Relation::OUTER_KEY => $this->options->get(Relation::INNER_KEY), - ]) + ]), ); } } diff --git a/src/Relation/ManyToMany.php b/src/Relation/ManyToMany.php index 1efff53..c239d7e 100644 --- a/src/Relation/ManyToMany.php +++ b/src/Relation/ManyToMany.php @@ -84,7 +84,7 @@ public function compute(Registry $registry): void throw new RelationException(sprintf( 'Relation ManyToMany must have the throughEntity declaration (%s => ? => %s).', $source->getRole(), - $target->getRole() + $target->getRole(), )); } @@ -94,7 +94,7 @@ public function compute(Registry $registry): void throw new RelationException(sprintf( 'Relation ManyToMany can only link entities from same database (%s, %s).', $source->getRole(), - $target->getRole() + $target->getRole(), )); } @@ -102,7 +102,7 @@ public function compute(Registry $registry): void throw new RelationException(sprintf( 'Relation ManyToMany can only link entities from same database (%s, %s)', $source->getRole(), - $through->getRole() + $through->getRole(), )); } @@ -113,20 +113,17 @@ public function compute(Registry $registry): void $source, Relation::INNER_KEY, $through, - Relation::THROUGH_INNER_KEY + Relation::THROUGH_INNER_KEY, ); $this->createRelatedFields( $target, Relation::OUTER_KEY, $through, - Relation::THROUGH_OUTER_KEY + Relation::THROUGH_OUTER_KEY, ); } - /** - * @param Registry $registry - */ public function render(Registry $registry): void { $source = $registry->getEntity($this->source); @@ -156,7 +153,7 @@ public function render(Registry $registry): void $through, $sourceFields, $throughSourceFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); $this->createForeignCompositeKey( $registry, @@ -164,13 +161,12 @@ public function render(Registry $registry): void $through, $targetFields, $throughTargetFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); } } /** - * @param Registry $registry * * @return Entity[] */ @@ -182,13 +178,9 @@ public function inverseTargets(Registry $registry): array } /** - * @param RelationInterface $relation - * @param string $into - * @param int|null $load * * @throws RelationException * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface { @@ -210,7 +202,7 @@ public function inverseRelation(RelationInterface $relation, string $into, ?int Relation::OUTER_KEY => $this->options->get(Relation::INNER_KEY), Relation::THROUGH_INNER_KEY => $this->options->get(Relation::THROUGH_OUTER_KEY), Relation::THROUGH_OUTER_KEY => $this->options->get(Relation::THROUGH_INNER_KEY), - ]) + ]), ); } } diff --git a/src/Relation/Morphed/BelongsToMorphed.php b/src/Relation/Morphed/BelongsToMorphed.php index 2c7a887..e42853b 100644 --- a/src/Relation/Morphed/BelongsToMorphed.php +++ b/src/Relation/Morphed/BelongsToMorphed.php @@ -47,9 +47,6 @@ final class BelongsToMorphed extends RelationSchema implements InversableInterfa RelationSchema::MORPH_KEY_LENGTH => 32, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { // compute local key @@ -66,7 +63,7 @@ public function compute(Registry $registry): void 'target:primaryKey' => $outerKeys, ]); - $outerKeys = array_combine($outerKeys, (array)$this->options->get(Relation::INNER_KEY)); + $outerKeys = array_combine($outerKeys, (array) $this->options->get(Relation::INNER_KEY)); // create target outer field foreach ($outerKeys as $key => $morphKey) { @@ -76,16 +73,16 @@ public function compute(Registry $registry): void $source, $morphKey, $outerField, - $this->options->get(Relation::NULLABLE) + $this->options->get(Relation::NULLABLE), ); } - foreach ((array)$this->options->get(Relation::MORPH_KEY) as $key) { + foreach ((array) $this->options->get(Relation::MORPH_KEY) as $key) { $this->ensureMorphField( $source, $key, $this->options->get(RelationSchema::MORPH_KEY_LENGTH), - $this->options->get(Relation::NULLABLE) + $this->options->get(Relation::NULLABLE), ); } } @@ -100,7 +97,6 @@ public function render(Registry $registry): void } /** - * @param Registry $registry * * @return Entity[] */ @@ -110,19 +106,15 @@ public function inverseTargets(Registry $registry): array } /** - * @param RelationInterface $relation - * @param string $into - * @param int|null $load * * @throws RelationException * - * @return RelationInterface */ public function inverseRelation(RelationInterface $relation, string $into, ?int $load = null): RelationInterface { if (!$relation instanceof MorphedHasOne && !$relation instanceof MorphedHasMany) { throw new RelationException( - 'BelongsToMorphed relation can only be inversed into MorphedHasOne or MorphedHasMany' + 'BelongsToMorphed relation can only be inversed into MorphedHasOne or MorphedHasMany', ); } @@ -134,7 +126,7 @@ public function inverseRelation(RelationInterface $relation, string $into, ?int Relation::LOAD => $load, Relation::INNER_KEY => $this->options->get(Relation::OUTER_KEY), Relation::OUTER_KEY => $this->options->get(Relation::INNER_KEY), - ]) + ]), ); } } diff --git a/src/Relation/Morphed/MorphedHasMany.php b/src/Relation/Morphed/MorphedHasMany.php index 2fd1943..6a8903d 100644 --- a/src/Relation/Morphed/MorphedHasMany.php +++ b/src/Relation/Morphed/MorphedHasMany.php @@ -46,9 +46,6 @@ final class MorphedHasMany extends RelationSchema RelationSchema::MORPH_KEY_LENGTH => 32, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { parent::compute($registry); @@ -69,7 +66,7 @@ public function compute(Registry $registry): void $target, $this->options->get(Relation::MORPH_KEY), $this->options->get(RelationSchema::MORPH_KEY_LENGTH), - $this->options->get(Relation::NULLABLE) + $this->options->get(Relation::NULLABLE), ); } diff --git a/src/Relation/Morphed/MorphedHasOne.php b/src/Relation/Morphed/MorphedHasOne.php index b45ea80..6c95d62 100644 --- a/src/Relation/Morphed/MorphedHasOne.php +++ b/src/Relation/Morphed/MorphedHasOne.php @@ -43,9 +43,6 @@ final class MorphedHasOne extends RelationSchema RelationSchema::MORPH_KEY_LENGTH => 32, ]; - /** - * @param Registry $registry - */ public function compute(Registry $registry): void { parent::compute($registry); @@ -66,7 +63,7 @@ public function compute(Registry $registry): void $target, $this->options->get(Relation::MORPH_KEY), $this->options->get(RelationSchema::MORPH_KEY_LENGTH), - $this->options->get(Relation::NULLABLE) + $this->options->get(Relation::NULLABLE), ); } diff --git a/src/Relation/OptionSchema.php b/src/Relation/OptionSchema.php index c0b8b06..6fdeb4f 100644 --- a/src/Relation/OptionSchema.php +++ b/src/Relation/OptionSchema.php @@ -12,28 +12,10 @@ final class OptionSchema { private array $options = []; - private array $template = []; - private array $context = []; - public function __construct(private array $aliases) - { - } - - public function __debugInfo(): array - { - $result = []; - - foreach ($this->template as $option => $value) { - $value = $this->get($option); - - $alias = array_search($option, $this->aliases, true); - $result[$alias] = $value; - } - - return $result; - } + public function __construct(private array $aliases) {} /** * Get available options @@ -127,6 +109,20 @@ public function get(int $option): mixed return $value; } + public function __debugInfo(): array + { + $result = []; + + foreach ($this->template as $option => $value) { + $value = $this->get($option); + + $alias = array_search($option, $this->aliases, true); + $result[$alias] = $value; + } + + return $result; + } + /** * Calculate option value using templating. */ diff --git a/src/Relation/RefersTo.php b/src/Relation/RefersTo.php index 6aa3ef9..8b1622c 100644 --- a/src/Relation/RefersTo.php +++ b/src/Relation/RefersTo.php @@ -58,7 +58,7 @@ public function compute(Registry $registry): void $target, Relation::OUTER_KEY, $source, - Relation::INNER_KEY + Relation::INNER_KEY, ); } @@ -83,7 +83,7 @@ public function render(Registry $registry): void $source, $outerFields, $innerFields, - $this->options->get(self::INDEX_CREATE) + $this->options->get(self::INDEX_CREATE), ); } } diff --git a/src/Relation/RelationSchema.php b/src/Relation/RelationSchema.php index 3a16ad4..2f27530 100644 --- a/src/Relation/RelationSchema.php +++ b/src/Relation/RelationSchema.php @@ -151,7 +151,7 @@ protected function hasIndex( array $columns, bool $strictOrder = true, bool $withSorting = true, - bool $unique = null + ?bool $unique = null, ): bool { if ($strictOrder && $withSorting && $unique === null) { return $table->hasIndex($columns); diff --git a/src/Relation/Traits/FieldTrait.php b/src/Relation/Traits/FieldTrait.php index fc443a4..c7efa24 100644 --- a/src/Relation/Traits/FieldTrait.php +++ b/src/Relation/Traits/FieldTrait.php @@ -26,10 +26,10 @@ protected function getField(Entity $entity, int $field): Field 'Field `%s`.`%s` does not exists, referenced by `%s`', $entity->getRole() ?? 'unknown', $this->getOptions()->get($field), - $this->source + $this->source, ), $e->getCode(), - $e + $e, ); } } @@ -37,7 +37,7 @@ protected function getField(Entity $entity, int $field): Field protected function getFields(Entity $entity, int $option): FieldMap { $fields = new FieldMap(); - $keys = (array)$this->getOptions()->get($option); + $keys = (array) $this->getOptions()->get($option); foreach ($keys as $key) { try { @@ -48,10 +48,10 @@ protected function getFields(Entity $entity, int $option): FieldMap 'Field `%s`.`%s` does not exists, referenced by `%s`.', $entity->getRole() ?? 'unknown', $key, - $this->source + $this->source, ), $e->getCode(), - $e + $e, ); } } @@ -63,10 +63,10 @@ protected function createRelatedFields( Entity $source, int $sourceKey, Entity $target, - int $targetKey + int $targetKey, ): void { $sourceFields = $this->getFields($source, $sourceKey); - $targetColumns = (array)$this->options->get($targetKey); + $targetColumns = (array) $this->options->get($targetKey); $sourceFieldNames = $sourceFields->getNames(); @@ -78,8 +78,8 @@ protected function createRelatedFields( $source->getRole() ?? 'unknown', implode('`, `', $this->getFields($source, $sourceKey)->getColumnNames()), $target->getRole() ?? 'unknown', - implode('`, `', $targetColumns) - ) + implode('`, `', $targetColumns), + ), ); } @@ -91,7 +91,7 @@ protected function createRelatedFields( $target, $targetColumn, $sourceField, - $this->options->get(Relation::NULLABLE) + $this->options->get(Relation::NULLABLE), ); } } @@ -102,7 +102,7 @@ protected function createRelatedFields( protected function normalizeContextFields( Entity $source, Entity $target, - array $keys = ['innerKey', 'outerKey'] + array $keys = ['innerKey', 'outerKey'], ): void { foreach ($keys as $key) { $options = $this->options->getOptions(); @@ -111,7 +111,7 @@ protected function normalizeContextFields( continue; } - $columns = (array)$options[$key]; + $columns = (array) $options[$key]; foreach ($columns as $i => $column) { $entity = $key === 'innerKey' ? $source : $target; diff --git a/src/Relation/Traits/ForeignKeyTrait.php b/src/Relation/Traits/ForeignKeyTrait.php index bba0869..4a618db 100644 --- a/src/Relation/Traits/ForeignKeyTrait.php +++ b/src/Relation/Traits/ForeignKeyTrait.php @@ -22,7 +22,7 @@ final protected function createForeignKey( Entity $target, Field $innerField, Field $outerField, - bool $indexCreate = true + bool $indexCreate = true, ): void { if ($registry->getDatabase($source) !== $registry->getDatabase($target)) { return; @@ -44,7 +44,7 @@ final protected function createForeignCompositeKey( Entity $target, FieldMap $innerFields, FieldMap $outerFields, - bool $indexCreate = true + bool $indexCreate = true, ): void { if ($registry->getDatabase($source) !== $registry->getDatabase($target)) { return; diff --git a/src/Relation/Traits/MorphTrait.php b/src/Relation/Traits/MorphTrait.php index 34408a4..4df32dc 100644 --- a/src/Relation/Traits/MorphTrait.php +++ b/src/Relation/Traits/MorphTrait.php @@ -19,11 +19,11 @@ trait MorphTrait * * @psalm-assert class-string $interface * - * @return Entity[]|Generator + * @return Entity[]|\Generator * * @psalm-return Generator */ - protected function findTargets(Registry $registry, string $interface): Generator + protected function findTargets(Registry $registry, string $interface): \Generator { foreach ($registry as $entity) { $class = $entity->getClass(); @@ -38,9 +38,9 @@ protected function findTargets(Registry $registry, string $interface): Generator /** * @param non-empty-string $interface * + * @return array Tuple [name, Field] * @throws RelationException * - * @return array Tuple [name, Field] */ protected function findOuterKey(Registry $registry, string $interface): array { @@ -52,7 +52,7 @@ protected function findOuterKey(Registry $registry, string $interface): array $primaryFields = $entity->getPrimaryFields(); $primaryKeys = $this->getPrimaryColumns($entity); - if (null === $keys) { + if ($keys === null) { $keys = $primaryKeys; $fields = $primaryFields; $prevEntity = $entity; @@ -62,12 +62,12 @@ protected function findOuterKey(Registry $registry, string $interface): array $entity->getRole() ?? 'unknown', implode(',', $primaryKeys), $prevEntity->getRole() ?? 'unknown', - implode(',', $keys) + implode(',', $keys), )); } } - if (null === $fields) { + if ($fields === null) { throw new RelationException('Unable to find morphed parent.'); } @@ -106,7 +106,7 @@ protected function mergeIndex(Registry $registry, Entity $source, FieldMap ...$m static function (FieldMap $map): array { return $map->getColumnNames(); }, - $mergeMaps + $mergeMaps, )); if (count($index) > 0) { diff --git a/src/RelationInterface.php b/src/RelationInterface.php index 0e303dc..959d518 100644 --- a/src/RelationInterface.php +++ b/src/RelationInterface.php @@ -25,6 +25,6 @@ public function withContext( string $name, string $source, string $target, - OptionSchema $options + OptionSchema $options, ): self; } diff --git a/src/SchemaModifierInterface.php b/src/SchemaModifierInterface.php index 72801b2..83a39be 100644 --- a/src/SchemaModifierInterface.php +++ b/src/SchemaModifierInterface.php @@ -27,8 +27,6 @@ public function compute(Registry $registry): void; /** * Render needed indexes and foreign keys into table. * - * @param Registry $registry - * * @throws SchemaModifierException * @throws DBALException */ diff --git a/src/Table/Column.php b/src/Table/Column.php index 60cf933..65bd383 100644 --- a/src/Table/Column.php +++ b/src/Table/Column.php @@ -37,8 +37,28 @@ final class Column private $typeOptions = []; /** - * @return string + * Parse field definition into table definition. + * + * @throws ColumnException + * */ + public static function parse(Field $field): self + { + $column = new self(); + $column->field = $field; + + if (!preg_match(self::DEFINITION, $field->getType(), $type)) { + throw new ColumnException("Invalid column type declaration in `{$field->getType()}`"); + } + + $column->type = $type['type']; + if (!empty($type['options'])) { + $column->typeOptions = array_map('trim', explode(',', $type['options'] ?? '')); + } + + return $column; + } + public function getName(): string { return $this->field->getColumn(); @@ -47,24 +67,17 @@ public function getName(): string /** * Get column type. * - * @return string */ public function getType(): string { return $this->type; } - /** - * @return bool - */ public function isPrimary(): bool { return $this->field->isPrimary() || in_array($this->type, ['primary', 'bigPrimary']); } - /** - * @return bool - */ public function isNullable(): bool { if ($this->hasDefault() && $this->getDefault() === null) { @@ -74,9 +87,6 @@ public function isNullable(): bool return $this->hasOption(self::OPT_NULLABLE) && !$this->isPrimary(); } - /** - * @return bool - */ public function hasDefault(): bool { if ($this->isPrimary()) { @@ -87,9 +97,9 @@ public function hasDefault(): bool } /** + * @return mixed * @throws ColumnException * - * @return mixed */ public function getDefault() { @@ -103,8 +113,6 @@ public function getDefault() /** * Render column definition. * - * @param AbstractColumn $column - * * @throws ColumnException */ public function render(AbstractColumn $column): void @@ -122,7 +130,7 @@ public function render(AbstractColumn $column): void throw new ColumnException( "Invalid column type definition in '{$column->getTable()}'.'{$column->getName()}'", (int) $e->getCode(), - $e + $e, ); } @@ -144,33 +152,6 @@ public function render(AbstractColumn $column): void } /** - * Parse field definition into table definition. - * - * @param Field $field - * - * @throws ColumnException - * - * @return Column - */ - public static function parse(Field $field): self - { - $column = new self(); - $column->field = $field; - - if (!preg_match(self::DEFINITION, $field->getType(), $type)) { - throw new ColumnException("Invalid column type declaration in `{$field->getType()}`"); - } - - $column->type = $type['type']; - if (!empty($type['options'])) { - $column->typeOptions = array_map('trim', explode(',', $type['options'] ?? '')); - } - - return $column; - } - - /** - * @param AbstractColumn $column * * @return bool|float|int|string */ @@ -197,11 +178,6 @@ private function castDefault(AbstractColumn $column) return ''; } - /** - * @param string $option - * - * @return bool - */ private function hasOption(string $option): bool { return $this->field->getOptions()->has($option); diff --git a/tests/Schema/BaseTest.php b/tests/Schema/BaseTest.php index fe19d50..df32add 100644 --- a/tests/Schema/BaseTest.php +++ b/tests/Schema/BaseTest.php @@ -28,12 +28,12 @@ abstract class BaseTest extends TestCase { // currently active driver public const DRIVER = null; + // tests configuration public static $config; // cross test driver cache public static $driverCache = []; - protected static $lastORM; /** @var Driver */ @@ -48,6 +48,33 @@ abstract class BaseTest extends TestCase /** @var TestLogger */ protected $logger; + /** + * Calculates missing parameters for typecasting. + * + * @return \Cycle\ORM\ORMInterface|ORM + */ + public function withSchema(SchemaInterface $schema) + { + $this->orm = $this->orm->withSchema($schema); + return $this->orm; + } + + public function getDriver(): Driver + { + if (isset(static::$driverCache[static::DRIVER])) { + return static::$driverCache[static::DRIVER]; + } + + $config = self::$config[static::DRIVER]; + if (!isset($this->driver)) { + $this->driver = $config->driver::create($config); + } + + $this->driver->setProfiling(true); + + return static::$driverCache[static::DRIVER] = $this->driver; + } + /** * Init all we need. */ @@ -60,16 +87,16 @@ public function setUp(): void new Database( 'default', '', - $this->getDriver() - ) + $this->getDriver(), + ), ); $this->dbal->addDatabase( new Database( 'secondary', 'secondary_', - $this->getDriver() - ) + $this->getDriver(), + ), ); $this->logger = new TestLogger(); @@ -89,9 +116,9 @@ public function setUp(): void $this->orm = new ORM( new Factory( $this->dbal, - RelationConfig::getDefault() + RelationConfig::getDefault(), ), - new Schema([]) + new Schema([]), ); } @@ -106,50 +133,12 @@ public function tearDown(): void $this->dbal = null; } - /** - * Calculates missing parameters for typecasting. - * - * @param SchemaInterface $schema - * - * @return \Cycle\ORM\ORMInterface|ORM - */ - public function withSchema(SchemaInterface $schema) - { - $this->orm = $this->orm->withSchema($schema); - return $this->orm; - } - - /** - * @return Driver - */ - public function getDriver(): Driver - { - if (isset(static::$driverCache[static::DRIVER])) { - return static::$driverCache[static::DRIVER]; - } - - $config = self::$config[static::DRIVER]; - if (!isset($this->driver)) { - $this->driver = $config->driver::create($config); - } - - $this->driver->setProfiling(true); - - return static::$driverCache[static::DRIVER] = $this->driver; - } - - /** - * @return Database - */ protected function getDatabase(): Database { return $this->dbal->database('default'); } - /** - * @param Database|null $database - */ - protected function dropDatabase(Database $database = null): void + protected function dropDatabase(?Database $database = null): void { if (empty($database)) { return; @@ -177,7 +166,7 @@ protected function dropDatabase(Database $database = null): void */ protected function enableProfiling(): void { - if (null !== $this->logger) { + if ($this->logger !== null) { $this->logger->display(); } } @@ -187,7 +176,7 @@ protected function enableProfiling(): void */ protected function disableProfiling(): void { - if (null !== $this->logger) { + if ($this->logger !== null) { $this->logger->hide(); } } diff --git a/tests/Schema/ColumnTest.php b/tests/Schema/ColumnTest.php index add4280..ff0c3b1 100644 --- a/tests/Schema/ColumnTest.php +++ b/tests/Schema/ColumnTest.php @@ -386,9 +386,6 @@ public function dataIsPrimary(): iterable ]; } - /** - * @return AbstractTable - */ protected function getStub(): AbstractTable { return $this->dbal->database('default')->table('sample')->getSchema(); diff --git a/tests/Schema/CompilerTest.php b/tests/Schema/CompilerTest.php index c55a815..f1a3ee2 100644 --- a/tests/Schema/CompilerTest.php +++ b/tests/Schema/CompilerTest.php @@ -21,16 +21,33 @@ final class CompilerTest extends TestCase { + public static function renderTypecastDataProvider(): \Traversable + { + yield [null, []]; + yield [Typecaster::class, [], Typecaster::class]; + yield [[Typecaster::class], [SchemaInterface::TYPECAST_HANDLER => Typecaster::class]]; + yield [ + [Typecaster::class, Typecast::class], + [SchemaInterface::TYPECAST_HANDLER => Typecast::class], + Typecaster::class, + ]; + yield [ + [Typecaster::class, Typecast::class], + [SchemaInterface::TYPECAST_HANDLER => [Typecaster::class, Typecast::class]], + Typecaster::class, + ]; + } + public function testWrongGeneratorShouldThrowAnException(): void { $this->expectException(CompilerException::class); $this->expectExceptionMessage( 'Invalid generator `\'Cycle\\\\Schema\\\\Tests\\\\Fixtures\\\\Author\'`. ' - . 'It should implement `Cycle\Schema\GeneratorInterface` interface.' + . 'It should implement `Cycle\Schema\GeneratorInterface` interface.', ); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $author = new Entity(); @@ -49,11 +66,11 @@ public function testWrongEntitySchemaModifierShouldThrowAnException(): void $this->expectException(SchemaModifierException::class); $this->expectExceptionMessage( 'Unable to apply schema modifier `Cycle\Schema\Tests\Fixtures\BrokenSchemaModifier` ' - . 'for the `author` role. Something went wrong' + . 'for the `author` role. Something went wrong', ); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $author = new Entity(); @@ -96,23 +113,23 @@ public function testRenderGeneratedFields(): void $entity->getFields()->set( 'createdAt', (new Field()) - ->setType('datetime') - ->setColumn('created_at') - ->setGenerated(GeneratedField::BEFORE_INSERT) + ->setType('datetime') + ->setColumn('created_at') + ->setGenerated(GeneratedField::BEFORE_INSERT), ); $entity->getFields()->set( 'updatedAt', (new Field()) - ->setType('datetime') - ->setColumn('created_at') - ->setGenerated(GeneratedField::BEFORE_INSERT | GeneratedField::BEFORE_UPDATE) + ->setType('datetime') + ->setColumn('created_at') + ->setGenerated(GeneratedField::BEFORE_INSERT | GeneratedField::BEFORE_UPDATE), ); $entity->getFields()->set( 'sequence', (new Field()) - ->setType('serial') - ->setColumn('some_sequence') - ->setGenerated(GeneratedField::ON_INSERT) + ->setType('serial') + ->setColumn('some_sequence') + ->setGenerated(GeneratedField::ON_INSERT), ); $r = new Registry($this->createMock(DatabaseProviderInterface::class)); @@ -126,21 +143,4 @@ public function testRenderGeneratedFields(): void 'sequence' => GeneratedField::ON_INSERT, ], $schema['author'][SchemaInterface::GENERATED_FIELDS]); } - - public static function renderTypecastDataProvider(): \Traversable - { - yield [null, []]; - yield [Typecaster::class, [], Typecaster::class]; - yield [[Typecaster::class], [SchemaInterface::TYPECAST_HANDLER => Typecaster::class]]; - yield [ - [Typecaster::class, Typecast::class], - [SchemaInterface::TYPECAST_HANDLER => Typecast::class], - Typecaster::class, - ]; - yield [ - [Typecaster::class, Typecast::class], - [SchemaInterface::TYPECAST_HANDLER => [Typecaster::class, Typecast::class]], - Typecaster::class, - ]; - } } diff --git a/tests/Schema/DefaultsTest.php b/tests/Schema/DefaultsTest.php index 0f82fde..5f3fb58 100644 --- a/tests/Schema/DefaultsTest.php +++ b/tests/Schema/DefaultsTest.php @@ -13,6 +13,57 @@ final class DefaultsTest extends TestCase { + public static function mergeDataProvider(): \Traversable + { + yield [ + [ + SchemaInterface::MAPPER => Mapper::class, + SchemaInterface::REPOSITORY => Repository::class, + SchemaInterface::SOURCE => Source::class, + SchemaInterface::SCOPE => null, + SchemaInterface::TYPECAST_HANDLER => null, + ], + [], + ]; + yield [ + [ + SchemaInterface::MAPPER => Mapper::class, + SchemaInterface::REPOSITORY => Repository::class, + SchemaInterface::SOURCE => Source::class, + SchemaInterface::SCOPE => null, + SchemaInterface::TYPECAST_HANDLER => null, + 'foo' => 'bar', + ], + [ + 'foo' => 'bar', + ], + ]; + yield [ + [ + SchemaInterface::MAPPER => Mapper::class, + SchemaInterface::REPOSITORY => Repository::class, + SchemaInterface::SOURCE => Source::class, + SchemaInterface::SCOPE => null, + SchemaInterface::TYPECAST_HANDLER => 'foo', + ], + [ + SchemaInterface::TYPECAST_HANDLER => 'foo', + ], + ]; + yield [ + [ + SchemaInterface::MAPPER => null, + SchemaInterface::REPOSITORY => Repository::class, + SchemaInterface::SOURCE => Source::class, + SchemaInterface::SCOPE => null, + SchemaInterface::TYPECAST_HANDLER => null, + ], + [ + SchemaInterface::MAPPER => null, + ], + ]; + } + public function testDefaultValues(): void { $defaults = new Defaults(); @@ -69,55 +120,4 @@ public function testOffsetUnset(): void $defaults->offsetUnset(SchemaInterface::MAPPER); $this->assertFalse($defaults->offsetExists(SchemaInterface::MAPPER)); } - - public static function mergeDataProvider(): \Traversable - { - yield [ - [ - SchemaInterface::MAPPER => Mapper::class, - SchemaInterface::REPOSITORY => Repository::class, - SchemaInterface::SOURCE => Source::class, - SchemaInterface::SCOPE => null, - SchemaInterface::TYPECAST_HANDLER => null, - ], - [], - ]; - yield [ - [ - SchemaInterface::MAPPER => Mapper::class, - SchemaInterface::REPOSITORY => Repository::class, - SchemaInterface::SOURCE => Source::class, - SchemaInterface::SCOPE => null, - SchemaInterface::TYPECAST_HANDLER => null, - 'foo' => 'bar', - ], - [ - 'foo' => 'bar', - ], - ]; - yield [ - [ - SchemaInterface::MAPPER => Mapper::class, - SchemaInterface::REPOSITORY => Repository::class, - SchemaInterface::SOURCE => Source::class, - SchemaInterface::SCOPE => null, - SchemaInterface::TYPECAST_HANDLER => 'foo', - ], - [ - SchemaInterface::TYPECAST_HANDLER => 'foo', - ], - ]; - yield [ - [ - SchemaInterface::MAPPER => null, - SchemaInterface::REPOSITORY => Repository::class, - SchemaInterface::SOURCE => Source::class, - SchemaInterface::SCOPE => null, - SchemaInterface::TYPECAST_HANDLER => null, - ], - [ - SchemaInterface::MAPPER => null, - ], - ]; - } } diff --git a/tests/Schema/Definition/Inheritance/JoinedTableInheritanceTest.php b/tests/Schema/Definition/Inheritance/JoinedTableInheritanceTest.php index 5788f59..1df02df 100644 --- a/tests/Schema/Definition/Inheritance/JoinedTableInheritanceTest.php +++ b/tests/Schema/Definition/Inheritance/JoinedTableInheritanceTest.php @@ -21,7 +21,7 @@ class JoinedTableInheritanceTest extends TestCase public function testJoinedTableShouldBeAddedToSchema() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -45,7 +45,7 @@ public function testJoinedTableShouldBeAddedToSchema() public function testJoinedTableWithoutOuterKeyShouldBeAddedToSchema() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -72,7 +72,7 @@ public function testJoinedTableWithNonExistsOuterKeyShouldThrowAnException() $this->expectExceptionMessage('Outer key column `foo_bar` is not found among fields of the `user` role.'); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); diff --git a/tests/Schema/Definition/Inheritance/SingleTableInheritanceTest.php b/tests/Schema/Definition/Inheritance/SingleTableInheritanceTest.php index 07f2c37..9550625 100644 --- a/tests/Schema/Definition/Inheritance/SingleTableInheritanceTest.php +++ b/tests/Schema/Definition/Inheritance/SingleTableInheritanceTest.php @@ -22,7 +22,7 @@ class SingleTableInheritanceTest extends TestCase public function testSingleTableShouldBeAddedToSchema() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $author = new Entity(); @@ -54,7 +54,7 @@ public function testSingleTableShouldBeAddedToSchema() public function testSingleTableWithExplicitPkShouldBeAddedToSchema() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $author = new Entity(); @@ -90,7 +90,7 @@ public function testSingleTableWithoutDiscriminatorColumnShouldThrowAnException( $this->expectExceptionMessage('Discriminator column for the `user` role should be defined.'); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -110,7 +110,7 @@ public function testSingleTableWithNonExistsDiscriminatorColumnShouldThrowAnExce $this->expectExceptionMessage('Discriminator column `type` is not found among fields of the `user` role.'); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -119,7 +119,7 @@ public function testSingleTableWithNonExistsDiscriminatorColumnShouldThrowAnExce $inheritance->setDiscriminator('type'); $user->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('id') + (new Field())->setType('primary')->setColumn('id'), ); $r->register($user); diff --git a/tests/Schema/Exception/TableInheritance/DiscriminatorColumnNotPresentExceptionTest.php b/tests/Schema/Exception/TableInheritance/DiscriminatorColumnNotPresentExceptionTest.php index f8a63af..d206742 100644 --- a/tests/Schema/Exception/TableInheritance/DiscriminatorColumnNotPresentExceptionTest.php +++ b/tests/Schema/Exception/TableInheritance/DiscriminatorColumnNotPresentExceptionTest.php @@ -23,12 +23,12 @@ public function testGetsSolution() $this->assertSame( 'Discriminator column is not present.', - $e->getName() + $e->getName(), ); $this->assertSame( "Discriminator column is required for Single Table Inheritance schema.\n" . 'You have to specify one of the defined fields of the `author` role: `id`, `name`', - $e->getSolution() + $e->getSolution(), ); } } diff --git a/tests/Schema/Exception/TableInheritance/WrongDiscriminatorColumnExceptionTest.php b/tests/Schema/Exception/TableInheritance/WrongDiscriminatorColumnExceptionTest.php index 056484a..0e0b516 100644 --- a/tests/Schema/Exception/TableInheritance/WrongDiscriminatorColumnExceptionTest.php +++ b/tests/Schema/Exception/TableInheritance/WrongDiscriminatorColumnExceptionTest.php @@ -23,11 +23,11 @@ public function testGetsSolution() $this->assertSame( 'Discriminator column is not found among the entity fields.', - $e->getName() + $e->getName(), ); $this->assertSame( 'You have to specify one of the defined fields of the `author` role: `id`, `name`', - $e->getSolution() + $e->getSolution(), ); } } diff --git a/tests/Schema/Exception/TableInheritance/WrongParentKeyColumnExceptionTest.php b/tests/Schema/Exception/TableInheritance/WrongParentKeyColumnExceptionTest.php index 0edbc62..49bfb59 100644 --- a/tests/Schema/Exception/TableInheritance/WrongParentKeyColumnExceptionTest.php +++ b/tests/Schema/Exception/TableInheritance/WrongParentKeyColumnExceptionTest.php @@ -23,11 +23,11 @@ public function testGetsSolution() $this->assertSame( 'Outer key column is not found among parent entity fields.', - $e->getName() + $e->getName(), ); $this->assertSame( 'You have to specify one of the defined fields of the `author` role: `id`, `name`', - $e->getSolution() + $e->getSolution(), ); } } diff --git a/tests/Schema/Fixtures/Author.php b/tests/Schema/Fixtures/Author.php index c8a8e67..2202939 100644 --- a/tests/Schema/Fixtures/Author.php +++ b/tests/Schema/Fixtures/Author.php @@ -17,12 +17,12 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); $entity->getFields()->set( 'p_name', - (new Field())->setType('string(32)')->setColumn('author_name') + (new Field())->setType('string(32)')->setColumn('author_name'), ); return $entity; @@ -43,7 +43,7 @@ public static function defineWithUser(): Entity $entity->getFields()->set( 'p_user_id', - (new Field())->setType('int(11)')->setColumn('user_id') + (new Field())->setType('int(11)')->setColumn('user_id'), ); return $entity; @@ -55,7 +55,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/AuthorInterface.php b/tests/Schema/Fixtures/AuthorInterface.php index 4a66346..4856b25 100644 --- a/tests/Schema/Fixtures/AuthorInterface.php +++ b/tests/Schema/Fixtures/AuthorInterface.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Tests\Fixtures; -interface AuthorInterface -{ -} +interface AuthorInterface {} diff --git a/tests/Schema/Fixtures/BrokenSchemaModifier.php b/tests/Schema/Fixtures/BrokenSchemaModifier.php index df698b0..36ac2fc 100644 --- a/tests/Schema/Fixtures/BrokenSchemaModifier.php +++ b/tests/Schema/Fixtures/BrokenSchemaModifier.php @@ -10,9 +10,7 @@ class BrokenSchemaModifier implements SchemaModifierInterface { - public function __construct(private string $brokenMethod) - { - } + public function __construct(private string $brokenMethod) {} public function withRole(string $role): static { diff --git a/tests/Schema/Fixtures/Composite.php b/tests/Schema/Fixtures/Composite.php index 7d0ad27..f24643a 100644 --- a/tests/Schema/Fixtures/Composite.php +++ b/tests/Schema/Fixtures/Composite.php @@ -24,7 +24,7 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); return $entity; @@ -38,7 +38,7 @@ public static function defineWithoutPk(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setColumn('id') + (new Field())->setColumn('id'), ); return $entity; diff --git a/tests/Schema/Fixtures/EmbeddedEntity.php b/tests/Schema/Fixtures/EmbeddedEntity.php index 67be7d2..7041d46 100644 --- a/tests/Schema/Fixtures/EmbeddedEntity.php +++ b/tests/Schema/Fixtures/EmbeddedEntity.php @@ -24,7 +24,7 @@ public static function define(): Entity $entity->getFields()->set( 'p_embedded', - (new Field())->setType('string')->setColumn('embedded_column') + (new Field())->setType('string')->setColumn('embedded_column'), ); return $entity; diff --git a/tests/Schema/Fixtures/In2.php b/tests/Schema/Fixtures/In2.php index 0d92e2e..26dcdcd 100644 --- a/tests/Schema/Fixtures/In2.php +++ b/tests/Schema/Fixtures/In2.php @@ -17,7 +17,7 @@ public static function define(): Entity $entity->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('uuid')->setPrimary(true) + (new Field())->setType('primary')->setColumn('uuid')->setPrimary(true), ); return $entity; @@ -29,7 +29,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/MorphedTo.php b/tests/Schema/Fixtures/MorphedTo.php index 26ae8a3..4622465 100644 --- a/tests/Schema/Fixtures/MorphedTo.php +++ b/tests/Schema/Fixtures/MorphedTo.php @@ -18,12 +18,12 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); $entity->getRelations()->set( 'parent', - (new Relation())->setTarget(ParentInterface::class)->setType('belongsToMorphed') + (new Relation())->setTarget(ParentInterface::class)->setType('belongsToMorphed'), ); return $entity; diff --git a/tests/Schema/Fixtures/ParentInterface.php b/tests/Schema/Fixtures/ParentInterface.php index 7177e27..b6fec87 100644 --- a/tests/Schema/Fixtures/ParentInterface.php +++ b/tests/Schema/Fixtures/ParentInterface.php @@ -4,6 +4,4 @@ namespace Cycle\Schema\Tests\Fixtures; -interface ParentInterface -{ -} +interface ParentInterface {} diff --git a/tests/Schema/Fixtures/Plain.php b/tests/Schema/Fixtures/Plain.php index 71eac2a..8ac14e4 100644 --- a/tests/Schema/Fixtures/Plain.php +++ b/tests/Schema/Fixtures/Plain.php @@ -18,7 +18,7 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); return $entity; @@ -32,7 +32,7 @@ public static function defineWithoutPK(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setColumn('id') + (new Field())->setColumn('id'), ); return $entity; @@ -44,7 +44,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/Post.php b/tests/Schema/Fixtures/Post.php index 92e96cc..bd21e43 100644 --- a/tests/Schema/Fixtures/Post.php +++ b/tests/Schema/Fixtures/Post.php @@ -18,12 +18,12 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); $entity->getRelations()->set( 'author', - (new Relation())->setTarget(Author::class)->setType('belongsTo') + (new Relation())->setTarget(Author::class)->setType('belongsTo'), ); return $entity; @@ -37,7 +37,7 @@ public static function defineWithoutPK(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setColumn('id') + (new Field())->setColumn('id'), ); return $entity; @@ -49,7 +49,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/Tag.php b/tests/Schema/Fixtures/Tag.php index 95300dd..da5c138 100644 --- a/tests/Schema/Fixtures/Tag.php +++ b/tests/Schema/Fixtures/Tag.php @@ -17,12 +17,12 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('bigPrimary')->setColumn('id')->setPrimary(true) + (new Field())->setType('bigPrimary')->setColumn('id')->setPrimary(true), ); $entity->getFields()->set( 'p_name', - (new Field())->setType('string(32)')->setColumn('name') + (new Field())->setType('string(32)')->setColumn('name'), ); return $entity; @@ -36,7 +36,7 @@ public static function defineWithoutPK(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setColumn('id') + (new Field())->setColumn('id'), ); return $entity; @@ -48,7 +48,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/TagContext.php b/tests/Schema/Fixtures/TagContext.php index 9466a67..85d0e66 100644 --- a/tests/Schema/Fixtures/TagContext.php +++ b/tests/Schema/Fixtures/TagContext.php @@ -17,7 +17,7 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('bigPrimary')->setColumn('id')->setPrimary(true) + (new Field())->setType('bigPrimary')->setColumn('id')->setPrimary(true), ); return $entity; diff --git a/tests/Schema/Fixtures/TestLogger.php b/tests/Schema/Fixtures/TestLogger.php index 0bd49b6..e4d578d 100644 --- a/tests/Schema/Fixtures/TestLogger.php +++ b/tests/Schema/Fixtures/TestLogger.php @@ -13,7 +13,6 @@ class TestLogger implements LoggerInterface use LoggerTrait; private $display; - private $countWrites; private $countReads; diff --git a/tests/Schema/Fixtures/Typecaster.php b/tests/Schema/Fixtures/Typecaster.php index 2e0508d..0951118 100644 --- a/tests/Schema/Fixtures/Typecaster.php +++ b/tests/Schema/Fixtures/Typecaster.php @@ -8,11 +8,7 @@ class Typecaster implements TypecastInterface { - public function cast(array $values): array - { - } + public function cast(array $values): array {} - public function setRules(array $rules): array - { - } + public function setRules(array $rules): array {} } diff --git a/tests/Schema/Fixtures/User.php b/tests/Schema/Fixtures/User.php index 9bbc2e1..ba3d696 100644 --- a/tests/Schema/Fixtures/User.php +++ b/tests/Schema/Fixtures/User.php @@ -19,33 +19,33 @@ public static function define(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setType('primary')->setColumn('id')->setPrimary(true) + (new Field())->setType('primary')->setColumn('id')->setPrimary(true), ); $entity->getFields()->set( 'p_name', - (new Field())->setType('string(32)')->setColumn('user_name') + (new Field())->setType('string(32)')->setColumn('user_name'), ); $entity->getFields()->set( 'p_active', - (new Field())->setType('bool')->setColumn('active') + (new Field())->setType('bool')->setColumn('active'), ); $entity->getFields()->set( 'p_balance', - (new Field())->setType('float')->setColumn('balance') + (new Field())->setType('float')->setColumn('balance'), ); $entity->getFields()->set( 'p_created_at', - (new Field())->setType('datetime')->setColumn('created_at') + (new Field())->setType('datetime')->setColumn('created_at'), ); $entity->getRelations()->set( 'plain', - (new Relation())->setTarget('plain')->setType('hasOne') + (new Relation())->setTarget('plain')->setType('hasOne'), ); return $entity; @@ -57,7 +57,7 @@ public static function defineCompositePK(): Entity $entity->getFields()->set( 'p_slug', - (new Field())->setType('string')->setColumn('slug')->setPrimary(true) + (new Field())->setType('string')->setColumn('slug')->setPrimary(true), ); return $entity; @@ -71,7 +71,7 @@ public static function defineWithoutPK(): Entity $entity->getFields()->set( 'p_id', - (new Field())->setColumn('id') + (new Field())->setColumn('id'), ); return $entity; diff --git a/tests/Schema/Generator/GenerateModifiersTest.php b/tests/Schema/Generator/GenerateModifiersTest.php index f499d68..f45b15c 100644 --- a/tests/Schema/Generator/GenerateModifiersTest.php +++ b/tests/Schema/Generator/GenerateModifiersTest.php @@ -23,7 +23,7 @@ class GenerateModifiersTest extends TestCase public function testEntityShouldBeModified() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -31,7 +31,7 @@ public function testEntityShouldBeModified() $user->getFields()->set('foo_bar', (new Field())->setType('primary')->setColumn('id')); $user->addSchemaModifier( - new class () implements SchemaModifierInterface { + new class implements SchemaModifierInterface { private string $role; public function withRole(string $role): static @@ -56,7 +56,7 @@ public function modifySchema(array &$schema): void { $schema[SchemaInterface::PARENT] = Author::class; } - } + }, ); $r->register($user); @@ -67,7 +67,7 @@ public function modifySchema(array &$schema): void $this->assertSame(Author::class, $schema['user'][SchemaInterface::PARENT]); $this->assertSame( ['foo_bar' => 'id', 'type' => 'type'], - $schema['user'][SchemaInterface::COLUMNS] + $schema['user'][SchemaInterface::COLUMNS], ); } @@ -78,11 +78,11 @@ public function testErrorInsideModifierShouldThrowAnException(string $method) { $this->expectException(SchemaException::class); $this->expectExceptionMessage( - 'Unable to compute modifier `Cycle\Schema\Tests\Fixtures\BrokenSchemaModifier` for the `user` role.' + 'Unable to compute modifier `Cycle\Schema\Tests\Fixtures\BrokenSchemaModifier` for the `user` role.', ); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); diff --git a/tests/Schema/Generator/GenerateRelationsTest.php b/tests/Schema/Generator/GenerateRelationsTest.php index 2779efb..1d2389e 100644 --- a/tests/Schema/Generator/GenerateRelationsTest.php +++ b/tests/Schema/Generator/GenerateRelationsTest.php @@ -40,7 +40,7 @@ public function relationOptionsDataProvider(): array public function testHasManyToManyRelationOptions( string $optionKey, array|string $optionValue, - int $relationKey + int $relationKey, ): void { $post = Post::define(); $tag = Tag::define(); @@ -53,8 +53,8 @@ public function testHasManyToManyRelationOptions( ->setType('manyToMany') ->setTarget('tag') ->getOptions() - ->set('though', 'tagContext') - ->set($optionKey, $optionValue); + ->set('though', 'tagContext') + ->set($optionKey, $optionValue); $r = new Registry($this->dbal); $r->register($post)->linkTable($post, 'default', 'post'); @@ -67,7 +67,7 @@ public function testHasManyToManyRelationOptions( // phpcs:ignore $this->assertSame( $optionValue, - $schema['post'][SchemaInterface::RELATIONS]['tags'][Relation::SCHEMA][$relationKey] + $schema['post'][SchemaInterface::RELATIONS]['tags'][Relation::SCHEMA][$relationKey], ); } @@ -93,7 +93,7 @@ public function testHasManyRelationOptions(string $optionKey, array|string $opti // phpcs:ignore $this->assertSame( $optionValue, - $schema['user'][SchemaInterface::RELATIONS]['plain'][Relation::SCHEMA][$relationKey] + $schema['user'][SchemaInterface::RELATIONS]['plain'][Relation::SCHEMA][$relationKey], ); } @@ -124,7 +124,7 @@ public function testHasManyToManyWithoutThroughEntity(): void $this->assertInstanceOf(RelationException::class, $e->getPrevious()); $this->assertStringContainsString( 'Relation ManyToMany must have the throughEntity declaration', - $e->getPrevious()->getMessage() + $e->getPrevious()->getMessage(), ); throw $e; } diff --git a/tests/Schema/Generator/PrintChangesTest.php b/tests/Schema/Generator/PrintChangesTest.php index 50cab90..71957db 100644 --- a/tests/Schema/Generator/PrintChangesTest.php +++ b/tests/Schema/Generator/PrintChangesTest.php @@ -22,22 +22,6 @@ abstract class PrintChangesTest extends BaseTest private PrintChanges $generator; private Compiler $compiler; - public function setUp(): void - { - parent::setUp(); - - $this->output = new BufferedOutput(); - $this->user = User::define(); - - $this->registry = new Registry($this->dbal); - $this->registry->register($this->user); - $this->registry->linkTable($this->user, 'default', 'users'); - - $this->generator = new PrintChanges($this->output); - - $this->compiler = new Compiler(); - } - public function testRunWithoutChanges(): void { $this->compiler->compile($this->registry, [new RenderTables()]); @@ -247,4 +231,20 @@ public function testRunChangedFkVerbose(): void $this->assertStringNotContainsString('default.users: 3 change(s) detected', $content); } + + public function setUp(): void + { + parent::setUp(); + + $this->output = new BufferedOutput(); + $this->user = User::define(); + + $this->registry = new Registry($this->dbal); + $this->registry->register($this->user); + $this->registry->linkTable($this->user, 'default', 'users'); + + $this->generator = new PrintChanges($this->output); + + $this->compiler = new Compiler(); + } } diff --git a/tests/Schema/Generator/RenderModifiersTest.php b/tests/Schema/Generator/RenderModifiersTest.php index c10c73c..5c218a5 100644 --- a/tests/Schema/Generator/RenderModifiersTest.php +++ b/tests/Schema/Generator/RenderModifiersTest.php @@ -21,7 +21,7 @@ class RenderModifiersTest extends TestCase public function testEntityShouldBeRendered() { $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); @@ -51,11 +51,11 @@ public function testErrorInsideModifierShouldThrowAnException(string $method) { $this->expectException(SchemaException::class); $this->expectExceptionMessage( - 'Unable to render modifier `Cycle\Schema\Tests\Fixtures\BrokenSchemaModifier` for the `user` role.' + 'Unable to render modifier `Cycle\Schema\Tests\Fixtures\BrokenSchemaModifier` for the `user` role.', ); $r = new Registry( - $this->createMock(DatabaseProviderInterface::class) + $this->createMock(DatabaseProviderInterface::class), ); $user = new Entity(); diff --git a/tests/Schema/Generator/RenderRelationsTest.php b/tests/Schema/Generator/RenderRelationsTest.php index 5232712..bb78a00 100644 --- a/tests/Schema/Generator/RenderRelationsTest.php +++ b/tests/Schema/Generator/RenderRelationsTest.php @@ -31,7 +31,7 @@ public function testFkActionAndFkOnDelete( null|false|string $fkActionOption, null|false|string $onDeleteOption, string $onUpdateExpected, - string $onDeleteExpected + string $onDeleteExpected, ): void { $plain = Plain::define(); $user = User::define(); diff --git a/tests/Schema/Generator/TableGeneratorTest.php b/tests/Schema/Generator/TableGeneratorTest.php index e26af39..f04b51a 100644 --- a/tests/Schema/Generator/TableGeneratorTest.php +++ b/tests/Schema/Generator/TableGeneratorTest.php @@ -48,7 +48,7 @@ public function testCompiled(): void (new RenderTables())->run($r), defaults: [ Schema::TYPECAST_HANDLER => 'default_typecaster', - ] + ], ); $this->assertSame([ @@ -85,7 +85,7 @@ public function testCompiledWithPassedDefaultTypecastHandler(): void (new RenderTables())->run($r), defaults: [ Schema::TYPECAST_HANDLER => Typecaster::class, - ] + ], ); $this->assertSame([ diff --git a/tests/Schema/RegistryTest.php b/tests/Schema/RegistryTest.php index e2977f6..1614c6a 100644 --- a/tests/Schema/RegistryTest.php +++ b/tests/Schema/RegistryTest.php @@ -121,7 +121,7 @@ public function testRegisterChildNoEntity(): void $e->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('id') + (new Field())->setType('primary')->setColumn('id'), ); $r = new Registry($this->dbal); @@ -132,12 +132,12 @@ public function testRegisterChildNoEntity(): void $c->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('id') + (new Field())->setType('primary')->setColumn('id'), ); $c->getFields()->set( 'name', - (new Field())->setType('string')->setColumn('name') + (new Field())->setType('string')->setColumn('name'), ); $this->expectException(RegistryException::class); @@ -153,7 +153,7 @@ public function testRegisterChild(): void $e->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('id') + (new Field())->setType('primary')->setColumn('id'), ); $r = new Registry($this->dbal); @@ -165,12 +165,12 @@ public function testRegisterChild(): void $c->getFields()->set( 'id', - (new Field())->setType('primary')->setColumn('id') + (new Field())->setType('primary')->setColumn('id'), ); $c->getFields()->set( 'name', - (new Field())->setType('string')->setColumn('name') + (new Field())->setType('string')->setColumn('name'), ); $r->registerChild($e, $c); diff --git a/tests/Schema/Relation/BelongsToRelationCompositePKTest.php b/tests/Schema/Relation/BelongsToRelationCompositePKTest.php index 646f148..59fbefd 100644 --- a/tests/Schema/Relation/BelongsToRelationCompositePKTest.php +++ b/tests/Schema/Relation/BelongsToRelationCompositePKTest.php @@ -215,17 +215,17 @@ public function testInverseToHasOne(): void $this->assertSame( 'post', - $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET] + $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET], ); $this->assertSame( ['author_p_id', 'author_p_slug'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -252,17 +252,17 @@ public function testInverseToHasMany(): void $this->assertSame( 'post', - $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET] + $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET], ); $this->assertSame( ['author_p_id', 'author_p_slug'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY], ); } } diff --git a/tests/Schema/Relation/BelongsToRelationTest.php b/tests/Schema/Relation/BelongsToRelationTest.php index dfc1213..23fd236 100644 --- a/tests/Schema/Relation/BelongsToRelationTest.php +++ b/tests/Schema/Relation/BelongsToRelationTest.php @@ -224,17 +224,17 @@ public function testInverseToHasOne(): void $this->assertSame( 'post', - $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET] + $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET], ); $this->assertSame( 'author_p_id', - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['p_id'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -261,17 +261,17 @@ public function testInverseToHasMany(): void $this->assertSame( 'post', - $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET] + $schema['author'][Schema::RELATIONS]['post'][Relation::TARGET], ); $this->assertSame( 'author_p_id', - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['p_id'], - $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['post'][Relation::SCHEMA][Relation::INNER_KEY], ); } diff --git a/tests/Schema/Relation/EmbeddedTest.php b/tests/Schema/Relation/EmbeddedTest.php index d7b0a2b..b4c65da 100644 --- a/tests/Schema/Relation/EmbeddedTest.php +++ b/tests/Schema/Relation/EmbeddedTest.php @@ -28,7 +28,7 @@ public function testGenerate(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $r = new Registry($this->dbal); @@ -50,7 +50,7 @@ public function testThrowAnExceptionWhenPkNotDefinedInSource(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $r = new Registry($this->dbal); @@ -69,7 +69,7 @@ public function testPackSchema(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $r = new Registry($this->dbal); @@ -83,12 +83,12 @@ public function testPackSchema(): void $this->assertArrayHasKey('embedded', $schema['composite'][Schema::RELATIONS]); $this->assertSame( \Cycle\ORM\Relation::EMBEDDED, - $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::TYPE] + $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::TYPE], ); $this->assertSame( \Cycle\ORM\Relation::LOAD_EAGER, - $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::LOAD] + $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::LOAD], ); $this->assertArrayHasKey('composite:embedded:embedded', $schema); @@ -111,7 +111,7 @@ public function testPackSchemaLazyLoad(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $c->getRelations()->get('embedded')->getOptions()->set('load', 'lazy'); @@ -127,12 +127,12 @@ public function testPackSchemaLazyLoad(): void $this->assertArrayHasKey('embedded', $schema['composite'][Schema::RELATIONS]); $this->assertSame( \Cycle\ORM\Relation::EMBEDDED, - $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::TYPE] + $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::TYPE], ); $this->assertSame( \Cycle\ORM\Relation::LOAD_PROMISE, - $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::LOAD] + $schema['composite'][Schema::RELATIONS]['embedded'][\Cycle\ORM\Relation::LOAD], ); $this->assertArrayHasKey('composite:embedded:embedded', $schema); @@ -153,7 +153,7 @@ public function testRenderTable(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $c->getRelations()->get('embedded')->getOptions()->set('load', 'lazy'); @@ -186,7 +186,7 @@ public function testEmbedIdFieldWithPrefix(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $r = new Registry($this->dbal); @@ -202,7 +202,7 @@ public function testEmbedIdFieldWithPrefix(): void new GenerateRelations(['embedded' => new Embedded()]), $t = new RenderTables(), new RenderRelations(), - ] + ], ); } @@ -213,7 +213,7 @@ public function testEmbeddedPrefix(): void $c->getRelations()->set( 'embedded', - (new Relation())->setTarget('embedded')->setType('embedded') + (new Relation())->setTarget('embedded')->setType('embedded'), ); $c->getRelations()->get('embedded')->getOptions()->set('embeddedPrefix', 'prefix_'); diff --git a/tests/Schema/Relation/HasManyRelationCompositePKTest.php b/tests/Schema/Relation/HasManyRelationCompositePKTest.php index b5aee4a..79ecbb8 100644 --- a/tests/Schema/Relation/HasManyRelationCompositePKTest.php +++ b/tests/Schema/Relation/HasManyRelationCompositePKTest.php @@ -211,17 +211,17 @@ public function testInverseToBelongsTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['user_p_id', 'user_p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -249,17 +249,17 @@ public function testInverseToRefersTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['user_p_id', 'user_p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } } diff --git a/tests/Schema/Relation/HasManyRelationTest.php b/tests/Schema/Relation/HasManyRelationTest.php index 1bf4975..78910e1 100644 --- a/tests/Schema/Relation/HasManyRelationTest.php +++ b/tests/Schema/Relation/HasManyRelationTest.php @@ -103,7 +103,7 @@ public function testPackSchema(): void $this->assertSame( ArrayCollectionFactory::class, - $schema['user'][Schema::RELATIONS]['plain'][Relation::SCHEMA][Relation::COLLECTION_TYPE] + $schema['user'][Schema::RELATIONS]['plain'][Relation::SCHEMA][Relation::COLLECTION_TYPE], ); } @@ -230,17 +230,17 @@ public function testInverseToBelongsTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'user_p_id', - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -268,17 +268,17 @@ public function testInverseToRefersTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'user_p_id', - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } diff --git a/tests/Schema/Relation/HasOneRelationCompositePKTest.php b/tests/Schema/Relation/HasOneRelationCompositePKTest.php index e31abd0..29536f7 100644 --- a/tests/Schema/Relation/HasOneRelationCompositePKTest.php +++ b/tests/Schema/Relation/HasOneRelationCompositePKTest.php @@ -280,17 +280,17 @@ public function testInverseToBelongsTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['user_p_id', 'user_p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -320,17 +320,17 @@ public function testInverseToBelongsLoadEager(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['user_p_id', 'user_p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -358,17 +358,17 @@ public function testInverseToRefersTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['user_p_id', 'user_p_slug'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } } diff --git a/tests/Schema/Relation/HasOneRelationTest.php b/tests/Schema/Relation/HasOneRelationTest.php index 44e7331..08d5600 100644 --- a/tests/Schema/Relation/HasOneRelationTest.php +++ b/tests/Schema/Relation/HasOneRelationTest.php @@ -288,17 +288,17 @@ public function testInverseToBelongsTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'user_p_id', - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -328,17 +328,17 @@ public function testInverseToBelongsLoadEager(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'user_p_id', - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } @@ -366,17 +366,17 @@ public function testInverseToRefersTo(): void $this->assertSame( 'user', - $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET] + $schema['plain'][Schema::RELATIONS]['user'][Relation::TARGET], ); $this->assertSame( ['p_id'], - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'user_p_id', - $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['plain'][Schema::RELATIONS]['user'][Relation::SCHEMA][Relation::INNER_KEY], ); } diff --git a/tests/Schema/Relation/ManyToManyRelationCompositePKTest.php b/tests/Schema/Relation/ManyToManyRelationCompositePKTest.php index edcbdb3..a5185d2 100644 --- a/tests/Schema/Relation/ManyToManyRelationCompositePKTest.php +++ b/tests/Schema/Relation/ManyToManyRelationCompositePKTest.php @@ -125,32 +125,32 @@ public function testPackSchema(): void $this->assertSame('tag', $schema['post'][Schema::RELATIONS]['tags'][Relation::TARGET]); $this->assertSame( Relation::MANY_TO_MANY, - $schema['post'][Schema::RELATIONS]['tags'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['tags'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['post_p_id', 'post_p_slug'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY], ); $this->assertSame( ['tag_p_id', 'tag_p_slug'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY], ); $this->assertSame( 'tagContext', - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_ENTITY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_ENTITY], ); } @@ -253,32 +253,32 @@ public function testInverse(): void $this->assertSame('post', $schema['tag'][Schema::RELATIONS]['posts'][Relation::TARGET]); $this->assertSame( Relation::MANY_TO_MANY, - $schema['tag'][Schema::RELATIONS]['posts'][Relation::TYPE] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( ['tag_p_id', 'tag_p_slug'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY], ); $this->assertSame( ['post_p_id', 'post_p_slug'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY], ); $this->assertSame( 'tagContext', - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_ENTITY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_ENTITY], ); } } diff --git a/tests/Schema/Relation/ManyToManyRelationTest.php b/tests/Schema/Relation/ManyToManyRelationTest.php index f20b792..c2304e1 100644 --- a/tests/Schema/Relation/ManyToManyRelationTest.php +++ b/tests/Schema/Relation/ManyToManyRelationTest.php @@ -181,37 +181,37 @@ public function testPackSchema(): void $this->assertSame('tag', $schema['post'][Schema::RELATIONS]['tags'][Relation::TARGET]); $this->assertSame( Relation::MANY_TO_MANY, - $schema['post'][Schema::RELATIONS]['tags'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['tags'][Relation::TYPE], ); $this->assertSame( ArrayCollectionFactory::class, - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::COLLECTION_TYPE] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::COLLECTION_TYPE], ); $this->assertSame( ['p_id'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( ['p_id'], - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'post_p_id', - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY], ); $this->assertSame( 'tag_p_id', - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY], ); $this->assertSame( 'tagContext', - $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_ENTITY] + $schema['post'][Schema::RELATIONS]['tags'][Relation::SCHEMA][Relation::THROUGH_ENTITY], ); } @@ -295,7 +295,7 @@ public function testDuplicatedUniqueIndexes(): void $table = $this->getDriver()->getSchema('tag_context'); assert($table instanceof AbstractTable); - $uniques = array_filter($table->getIndexes(), static fn (AbstractIndex $index): bool => $index->isUnique()); + $uniques = array_filter($table->getIndexes(), static fn(AbstractIndex $index): bool => $index->isUnique()); $this->assertTrue($table->hasColumn('id')); $this->assertTrue($table->hasColumn('post_p_id')); @@ -372,32 +372,32 @@ public function testInverse(): void $this->assertSame('post', $schema['tag'][Schema::RELATIONS]['posts'][Relation::TARGET]); $this->assertSame( Relation::MANY_TO_MANY, - $schema['tag'][Schema::RELATIONS]['posts'][Relation::TYPE] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::TYPE], ); $this->assertSame( ['p_id'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( ['p_id'], - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'tag_p_id', - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_INNER_KEY], ); $this->assertSame( 'post_p_id', - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_OUTER_KEY], ); $this->assertSame( 'tagContext', - $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_ENTITY] + $schema['tag'][Schema::RELATIONS]['posts'][Relation::SCHEMA][Relation::THROUGH_ENTITY], ); } diff --git a/tests/Schema/Relation/Morphed/BelongsToMorphedRelationCompositePKTest.php b/tests/Schema/Relation/Morphed/BelongsToMorphedRelationCompositePKTest.php index d44ae78..5d706d9 100644 --- a/tests/Schema/Relation/Morphed/BelongsToMorphedRelationCompositePKTest.php +++ b/tests/Schema/Relation/Morphed/BelongsToMorphedRelationCompositePKTest.php @@ -80,7 +80,7 @@ public function testPackSchema(): void $this->assertArrayHasKey('morphed', $schema); $this->assertSame( Relation::BELONGS_TO_MORPHED, - $schema['morphed'][Schema::RELATIONS]['parent'][Relation::TYPE] + $schema['morphed'][Schema::RELATIONS]['parent'][Relation::TYPE], ); $this->assertArrayHasKey('morphed', $schema); @@ -175,33 +175,33 @@ public function testInverseHasOne(): void $this->assertArrayHasKey('morphed', $schema['author'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_ONE, - $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); $this->assertArrayHasKey('morphed', $schema['post'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_ONE, - $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( ['parent_p_id', 'parent_p_slug'], - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::OUTER_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::OUTER_KEY], ); $this->assertSame( 'parent_role', - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); } @@ -230,29 +230,29 @@ public function testInverseHasMany(): void $this->assertArrayHasKey('morphed', $schema['author'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_MANY, - $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); $this->assertArrayHasKey('morphed', $schema['post'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_MANY, - $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id', 'p_slug'], - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); } } diff --git a/tests/Schema/Relation/Morphed/BelongsToMorphedRelationTest.php b/tests/Schema/Relation/Morphed/BelongsToMorphedRelationTest.php index d8f3454..d9cb6d5 100644 --- a/tests/Schema/Relation/Morphed/BelongsToMorphedRelationTest.php +++ b/tests/Schema/Relation/Morphed/BelongsToMorphedRelationTest.php @@ -81,7 +81,7 @@ public function testPackSchema(): void $this->assertArrayHasKey('morphed', $schema); $this->assertSame( Relation::BELONGS_TO_MORPHED, - $schema['morphed'][Schema::RELATIONS]['parent'][Relation::TYPE] + $schema['morphed'][Schema::RELATIONS]['parent'][Relation::TYPE], ); $this->assertArrayHasKey('morphed', $schema); @@ -174,29 +174,29 @@ public function testInverseHasOne(): void $this->assertArrayHasKey('morphed', $schema['author'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_ONE, - $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id'], - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); $this->assertArrayHasKey('morphed', $schema['post'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_ONE, - $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id'], - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); } @@ -225,29 +225,29 @@ public function testInverseHasMany(): void $this->assertArrayHasKey('morphed', $schema['author'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_MANY, - $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id'], - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['author'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); $this->assertArrayHasKey('morphed', $schema['post'][Schema::RELATIONS]); $this->assertSame( Relation::MORPHED_HAS_MANY, - $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::TYPE], ); $this->assertSame( ['p_id'], - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::INNER_KEY], ); $this->assertSame( 'parent_role', - $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY] + $schema['post'][Schema::RELATIONS]['morphed'][Relation::SCHEMA][Relation::MORPH_KEY], ); } } diff --git a/tests/Schema/Relation/Morphed/MorphedHasManyRelationTest.php b/tests/Schema/Relation/Morphed/MorphedHasManyRelationTest.php index e0fe47e..5522a79 100644 --- a/tests/Schema/Relation/Morphed/MorphedHasManyRelationTest.php +++ b/tests/Schema/Relation/Morphed/MorphedHasManyRelationTest.php @@ -66,7 +66,7 @@ public function testPackSchema(): void $this->assertSame( ArrayCollectionFactory::class, - $schema['user'][Schema::RELATIONS]['plain'][Relation::SCHEMA][Relation::COLLECTION_TYPE] + $schema['user'][Schema::RELATIONS]['plain'][Relation::SCHEMA][Relation::COLLECTION_TYPE], ); } diff --git a/tests/Schema/Relation/Traits/FieldTraitTest.php b/tests/Schema/Relation/Traits/FieldTraitTest.php index 1526184..ba15a62 100644 --- a/tests/Schema/Relation/Traits/FieldTraitTest.php +++ b/tests/Schema/Relation/Traits/FieldTraitTest.php @@ -18,21 +18,10 @@ class FieldTraitTest extends TestCase /** @var OptionSchema */ private $options; + /** @var string */ private $source; - protected function setUp(): void - { - parent::setUp(); - - $this->options = (new OptionSchema([]))->withTemplate([ - 123 => 'id', - 234 => ['id', 'slug'], - ]); - - $this->source = 'test'; - } - public function testGetsFieldShouldReturnFieldIfItExists(): void { $entity = new Entity(); @@ -111,7 +100,7 @@ public function testEnsureFieldIfFieldExistsItShouldNotBeCreated(): void public function testEnsureFieldIfFieldNotExistsItShouldBeCreated( string $originalType, string $type, - bool $nullable + bool $nullable, ): void { $target = new Entity(); @@ -166,9 +155,18 @@ public function outerFieldTypes(): iterable ]; } - /** - * @return OptionSchema - */ + protected function setUp(): void + { + parent::setUp(); + + $this->options = (new OptionSchema([]))->withTemplate([ + 123 => 'id', + 234 => ['id', 'slug'], + ]); + + $this->source = 'test'; + } + protected function getOptions(): OptionSchema { return $this->options; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 42107df..59648d7 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,7 +29,7 @@ user: 'root', password: 'root', ), - queryCache: true + queryCache: true, ), 'postgres' => new Config\PostgresDriverConfig( connection: new Config\Postgres\TcpConnectionConfig( @@ -48,9 +48,9 @@ host: '127.0.0.1', port: 11433, user: 'SA', - password: 'SSpaSS__1' + password: 'SSpaSS__1', ), - queryCache: true + queryCache: true, ), ]; @@ -62,5 +62,5 @@ ] + ( $db === null ? $drivers - : array_intersect_key($drivers, array_flip((array)$db)) + : array_intersect_key($drivers, array_flip((array) $db)) ); diff --git a/tests/generate.php b/tests/generate.php index 88408d2..f98f3bf 100644 --- a/tests/generate.php +++ b/tests/generate.php @@ -75,8 +75,8 @@ class %s extends %s $class->getName() . ' as ' . $baseTestName, $class->getShortName(), $baseTestName, - $driver - ) + $driver, + ), ); } } From 01bd716ca6e84a64c9353bc7660b568c9f297c4f Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 13 Dec 2024 19:38:49 +0400 Subject: [PATCH 3/4] Reuse cycle testing workflows --- .github/workflows/ci-mssql.yml | 94 ++---------------- .github/workflows/ci-mysql.yml | 96 ++---------------- .github/workflows/ci-pgsql.yml | 97 ++----------------- .github/workflows/cs-fix.yml | 16 +++ .github/workflows/psalm.yml | 23 ++--- ...elongsToMorphedRelationCompositePKTest.php | 4 + .../MySQL/BelongsToMorphedRelationTest.php | 4 + .../BelongsToRelationCompositePKTest.php | 4 + .../Driver/MySQL/BelongsToRelationTest.php | 4 + tests/Schema/Driver/MySQL/ColumnTest.php | 4 + tests/Schema/Driver/MySQL/EmbeddedTest.php | 4 + tests/Schema/Driver/MySQL/ForeignKeysTest.php | 6 +- .../Driver/MySQL/GenerateRelationsTest.php | 4 + .../MySQL/HasManyRelationCompositePKTest.php | 4 + .../Driver/MySQL/HasManyRelationTest.php | 4 + .../MySQL/HasOneRelationCompositePKTest.php | 4 + .../Driver/MySQL/HasOneRelationTest.php | 4 + .../ManyToManyRelationCompositePKTest.php | 4 + .../Driver/MySQL/ManyToManyRelationTest.php | 4 + .../MorphedHasManyRelationCompositePKTest.php | 4 + .../MySQL/MorphedHasManyRelationTest.php | 4 + .../MorphedHasOneRelationCompositePKTest.php | 4 + .../MySQL/MorphedHasOneRelationTest.php | 4 + .../Schema/Driver/MySQL/PrintChangesTest.php | 6 +- .../MySQL/RefersToRelationCompositePKTest.php | 4 + .../Driver/MySQL/RefersToRelationTest.php | 4 + tests/Schema/Driver/MySQL/RegistryTest.php | 4 + .../Driver/MySQL/RenderRelationsTest.php | 4 + .../Driver/MySQL/ResolveInterfacesTest.php | 4 + .../Driver/MySQL/TableGeneratorTest.php | 4 + .../Driver/MySQL/TypecastGeneratorTest.php | 4 + ...elongsToMorphedRelationCompositePKTest.php | 4 + .../Postgres/BelongsToMorphedRelationTest.php | 4 + .../BelongsToRelationCompositePKTest.php | 4 + .../Driver/Postgres/BelongsToRelationTest.php | 4 + tests/Schema/Driver/Postgres/ColumnTest.php | 4 + tests/Schema/Driver/Postgres/EmbeddedTest.php | 4 + .../Driver/Postgres/ForeignKeysTest.php | 6 +- .../Driver/Postgres/GenerateRelationsTest.php | 4 + .../HasManyRelationCompositePKTest.php | 4 + .../Driver/Postgres/HasManyRelationTest.php | 4 + .../HasOneRelationCompositePKTest.php | 4 + .../Driver/Postgres/HasOneRelationTest.php | 4 + .../ManyToManyRelationCompositePKTest.php | 4 + .../Postgres/ManyToManyRelationTest.php | 4 + .../MorphedHasManyRelationCompositePKTest.php | 4 + .../Postgres/MorphedHasManyRelationTest.php | 4 + .../MorphedHasOneRelationCompositePKTest.php | 4 + .../Postgres/MorphedHasOneRelationTest.php | 4 + .../Driver/Postgres/PrintChangesTest.php | 6 +- .../RefersToRelationCompositePKTest.php | 4 + .../Driver/Postgres/RefersToRelationTest.php | 4 + tests/Schema/Driver/Postgres/RegistryTest.php | 4 + .../Driver/Postgres/RenderRelationsTest.php | 4 + .../Driver/Postgres/ResolveInterfacesTest.php | 4 + .../Driver/Postgres/TableGeneratorTest.php | 4 + .../Driver/Postgres/TypecastGeneratorTest.php | 4 + ...elongsToMorphedRelationCompositePKTest.php | 4 + .../BelongsToMorphedRelationTest.php | 4 + .../BelongsToRelationCompositePKTest.php | 4 + .../SQLServer/BelongsToRelationTest.php | 4 + tests/Schema/Driver/SQLServer/ColumnTest.php | 4 + .../Schema/Driver/SQLServer/EmbeddedTest.php | 4 + .../Driver/SQLServer/ForeignKeysTest.php | 6 +- .../SQLServer/GenerateRelationsTest.php | 4 + .../HasManyRelationCompositePKTest.php | 4 + .../Driver/SQLServer/HasManyRelationTest.php | 4 + .../HasOneRelationCompositePKTest.php | 4 + .../Driver/SQLServer/HasOneRelationTest.php | 4 + .../ManyToManyRelationCompositePKTest.php | 4 + .../SQLServer/ManyToManyRelationTest.php | 4 + .../MorphedHasManyRelationCompositePKTest.php | 4 + .../SQLServer/MorphedHasManyRelationTest.php | 4 + .../MorphedHasOneRelationCompositePKTest.php | 4 + .../SQLServer/MorphedHasOneRelationTest.php | 4 + .../Driver/SQLServer/PrintChangesTest.php | 6 +- .../RefersToRelationCompositePKTest.php | 4 + .../Driver/SQLServer/RefersToRelationTest.php | 4 + .../Schema/Driver/SQLServer/RegistryTest.php | 4 + .../Driver/SQLServer/RenderRelationsTest.php | 4 + .../SQLServer/ResolveInterfacesTest.php | 4 + .../Driver/SQLServer/TableGeneratorTest.php | 4 + .../SQLServer/TypecastGeneratorTest.php | 4 + ...elongsToMorphedRelationCompositePKTest.php | 4 + .../SQLite/BelongsToMorphedRelationTest.php | 4 + .../BelongsToRelationCompositePKTest.php | 4 + .../Driver/SQLite/BelongsToRelationTest.php | 4 + tests/Schema/Driver/SQLite/ColumnTest.php | 4 + tests/Schema/Driver/SQLite/EmbeddedTest.php | 4 + .../Schema/Driver/SQLite/ForeignKeysTest.php | 6 +- .../Driver/SQLite/GenerateRelationsTest.php | 4 + .../SQLite/HasManyRelationCompositePKTest.php | 4 + .../Driver/SQLite/HasManyRelationTest.php | 4 + .../SQLite/HasOneRelationCompositePKTest.php | 4 + .../Driver/SQLite/HasOneRelationTest.php | 4 + .../ManyToManyRelationCompositePKTest.php | 4 + .../Driver/SQLite/ManyToManyRelationTest.php | 4 + .../MorphedHasManyRelationCompositePKTest.php | 4 + .../SQLite/MorphedHasManyRelationTest.php | 4 + .../MorphedHasOneRelationCompositePKTest.php | 4 + .../SQLite/MorphedHasOneRelationTest.php | 4 + .../Schema/Driver/SQLite/PrintChangesTest.php | 6 +- .../RefersToRelationCompositePKTest.php | 4 + .../Driver/SQLite/RefersToRelationTest.php | 4 + tests/Schema/Driver/SQLite/RegistryTest.php | 4 + .../Driver/SQLite/RenderRelationsTest.php | 4 + .../Driver/SQLite/ResolveInterfacesTest.php | 4 + .../Driver/SQLite/TableGeneratorTest.php | 4 + .../Driver/SQLite/TypecastGeneratorTest.php | 4 + tests/bootstrap.php | 6 +- tests/docker-compose.yml | 6 +- tests/generate.php | 8 ++ 112 files changed, 485 insertions(+), 293 deletions(-) create mode 100644 .github/workflows/cs-fix.yml diff --git a/.github/workflows/ci-mssql.yml b/.github/workflows/ci-mssql.yml index 093a41b..2f5f2ea 100644 --- a/.github/workflows/ci-mssql.yml +++ b/.github/workflows/ci-mssql.yml @@ -1,96 +1,16 @@ -on: +--- + +on: # yamllint disable-line rule:truthy push: branches: - - master - '*.*' - '*.*.*' pull_request: null -name: ci-mssql +name: MSSQL jobs: - tests: - name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} - - env: - key: cache - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - include: - - php: '8.0' - extensions: pdo, pdo_sqlsrv - mssql: 'server:2017-latest' - - php: '8.0' - extensions: pdo, pdo_sqlsrv - mssql: 'server:2019-latest' - odbc-version: 18 - flag: "-C" - - php: '8.1' - extensions: pdo, pdo_sqlsrv - mssql: 'server:2019-latest' - odbc-version: 18 - flag: "-C" - - php: '8.2' - extensions: pdo, pdo_sqlsrv - mssql: 'server:2019-latest' - odbc-version: 18 - flag: "-C" - - php: '8.3' - extensions: pdo, pdo_sqlsrv - mssql: 'server:2019-latest' - odbc-version: 18 - flag: "-C" - - services: - mssql: - image: mcr.microsoft.com/mssql/${{ matrix.mssql }} - env: - SA_PASSWORD: SSpaSS__1 - ACCEPT_EULA: Y - MSSQL_PID: Developer - ports: - - 11433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.odbc-version }}/bin/sqlcmd ${{ matrix.flag }} -S localhost -U SA -P 'SSpaSS__1' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=5 - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ matrix.extensions }} - ini-values: date.timezone='UTC' - tools: composer:v2, pecl - - - name: Determine composer cache directory on Linux - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - - name: Update composer - run: composer self-update - - - name: Install dependencies with composer - if: matrix.php != '8.3' - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Install dependencies with composer php 8.3 - if: matrix.php == '8.3' - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + phpunit: + uses: cycle/gh-actions/.github/workflows/db-mssql.yml@master - - name: Run tests with phpunit without coverage - env: - DB: sqlserver - run: vendor/bin/phpunit tests/Schema/Driver/SQLServer --colors=always +... diff --git a/.github/workflows/ci-mysql.yml b/.github/workflows/ci-mysql.yml index 13ade5e..c0ccde1 100644 --- a/.github/workflows/ci-mysql.yml +++ b/.github/workflows/ci-mysql.yml @@ -1,98 +1,16 @@ -on: +--- + +on: # yamllint disable-line rule:truthy push: branches: - - master - '*.*' - '*.*.*' pull_request: null -name: ci-mysql +name: MySQL jobs: - tests: - name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }} - env: - extensions: curl, intl, pdo, pdo_mysql - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - php-version: - - "8.0" - - "8.1" - - "8.2" - - "8.3" - - mysql-version: - - "5.7" - - "8.0" - - services: - mysql: - image: mysql:${{ matrix.mysql-version }} - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: spiral - MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password - ports: - - 13306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v2 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - restore-keys: ${{ steps.cache-env.outputs.key }} - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: pcov - - - name: Determine composer cache directory - if: matrix.os == 'ubuntu-latest' - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- - - - name: Install dependencies with composer - if: matrix.php-version != '8.3' - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Install dependencies with composer php 8.3 - if: matrix.php-version == '8.3' - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + phpunit: + uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master - - name: Run mysql tests with phpunit - env: - DB: mysql - MYSQL: ${{ matrix.mysql-version }} - run: vendor/bin/phpunit tests/Schema/Driver/MySQL --colors=always +... diff --git a/.github/workflows/ci-pgsql.yml b/.github/workflows/ci-pgsql.yml index 6d1c8a5..2b3f8e7 100644 --- a/.github/workflows/ci-pgsql.yml +++ b/.github/workflows/ci-pgsql.yml @@ -1,99 +1,16 @@ -on: +--- + +on: # yamllint disable-line rule:truthy push: branches: - - master - '*.*' - '*.*.*' pull_request: null -name: ci-pgsql +name: Postgres jobs: - tests: - name: PHP ${{ matrix.php-version }}-pgsql-${{ matrix.pgsql-version }} - env: - extensions: curl, intl, pdo, pdo_pgsql - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - php-version: - - "8.0" - - "8.1" - - "8.2" - - "8.3" - - pgsql-version: - - "10" - - "11" - - "12" - - "13" - - services: - postgres: - image: postgres:${{ matrix.pgsql-version }} - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: spiral - ports: - - 15432:5432 - options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v2 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - restore-keys: ${{ steps.cache-env.outputs.key }} - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: pcov - - - name: Determine composer cache directory - if: matrix.os == 'ubuntu-latest' - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- - - - name: Install dependencies with composer - if: matrix.php-version != '8.3' - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Install dependencies with composer php 8.3 - if: matrix.php-version == '8.3' - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + phpunit: + uses: cycle/gh-actions/.github/workflows/db-pgsql.yml@master - - name: Run pgsql tests with phpunit - env: - DB: postgres - POSTGRES: ${{ matrix.pgsql-version }} - run: vendor/bin/phpunit tests/Schema/Driver/Postgres --colors=always +... diff --git a/.github/workflows/cs-fix.yml b/.github/workflows/cs-fix.yml new file mode 100644 index 0000000..db5860c --- /dev/null +++ b/.github/workflows/cs-fix.yml @@ -0,0 +1,16 @@ +--- + +on: # yamllint disable-line rule:truthy + push: + branches: + - '*' + +name: Fix Code Style + +jobs: + cs-fix: + permissions: + contents: write + uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master + +... diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 7442516..4c1f9dd 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -1,18 +1,15 @@ on: - pull_request: - push: - branches: - - master - - '*.*' - - '*.*.*' + pull_request: null + push: + branches: + - master + - '*.*' name: static analysis jobs: - psalm: - uses: spiral/gh-actions/.github/workflows/psalm.yml@master - with: - os: >- - ['ubuntu-latest'] - php: >- - ['8.3'] + psalm: + uses: spiral/gh-actions/.github/workflows/psalm.yml@master + with: + os: >- + ['ubuntu-latest'] diff --git a/tests/Schema/Driver/MySQL/BelongsToMorphedRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/BelongsToMorphedRelationCompositePKTest.php index 7bdc593..89eec6e 100644 --- a/tests/Schema/Driver/MySQL/BelongsToMorphedRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/BelongsToMorphedRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class BelongsToMorphedRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/BelongsToMorphedRelationTest.php b/tests/Schema/Driver/MySQL/BelongsToMorphedRelationTest.php index 41e221b..de6ba1b 100644 --- a/tests/Schema/Driver/MySQL/BelongsToMorphedRelationTest.php +++ b/tests/Schema/Driver/MySQL/BelongsToMorphedRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class BelongsToMorphedRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/BelongsToRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/BelongsToRelationCompositePKTest.php index 11a9e4f..2ecb67a 100644 --- a/tests/Schema/Driver/MySQL/BelongsToRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/BelongsToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\BelongsToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class BelongsToRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/BelongsToRelationTest.php b/tests/Schema/Driver/MySQL/BelongsToRelationTest.php index 55a4dcb..07eda1b 100644 --- a/tests/Schema/Driver/MySQL/BelongsToRelationTest.php +++ b/tests/Schema/Driver/MySQL/BelongsToRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\BelongsToRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class BelongsToRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/ColumnTest.php b/tests/Schema/Driver/MySQL/ColumnTest.php index 7acbd67..6fe1f2a 100644 --- a/tests/Schema/Driver/MySQL/ColumnTest.php +++ b/tests/Schema/Driver/MySQL/ColumnTest.php @@ -8,6 +8,10 @@ use Cycle\Schema\Table\Column; use Cycle\Schema\Tests\ColumnTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class ColumnTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/EmbeddedTest.php b/tests/Schema/Driver/MySQL/EmbeddedTest.php index 315edb0..0932517 100644 --- a/tests/Schema/Driver/MySQL/EmbeddedTest.php +++ b/tests/Schema/Driver/MySQL/EmbeddedTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\EmbeddedTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class EmbeddedTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/ForeignKeysTest.php b/tests/Schema/Driver/MySQL/ForeignKeysTest.php index 321553e..7ff2b01 100644 --- a/tests/Schema/Driver/MySQL/ForeignKeysTest.php +++ b/tests/Schema/Driver/MySQL/ForeignKeysTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\ForeignKeysTest as BaseTest; -final class ForeignKeysTest extends BaseTest +/** + * @group driver + * @group driver-mysql + */ +class ForeignKeysTest extends BaseTest { public const DRIVER = 'mysql'; } diff --git a/tests/Schema/Driver/MySQL/GenerateRelationsTest.php b/tests/Schema/Driver/MySQL/GenerateRelationsTest.php index 88d9eb1..c1facdc 100644 --- a/tests/Schema/Driver/MySQL/GenerateRelationsTest.php +++ b/tests/Schema/Driver/MySQL/GenerateRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\GenerateRelationsTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class GenerateRelationsTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/HasManyRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/HasManyRelationCompositePKTest.php index b9aa784..f326257 100644 --- a/tests/Schema/Driver/MySQL/HasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/HasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class HasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/HasManyRelationTest.php b/tests/Schema/Driver/MySQL/HasManyRelationTest.php index b326691..eb68115 100644 --- a/tests/Schema/Driver/MySQL/HasManyRelationTest.php +++ b/tests/Schema/Driver/MySQL/HasManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class HasManyRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/HasOneRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/HasOneRelationCompositePKTest.php index 68a076b..75db132 100644 --- a/tests/Schema/Driver/MySQL/HasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/HasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class HasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/HasOneRelationTest.php b/tests/Schema/Driver/MySQL/HasOneRelationTest.php index 56dad22..4117100 100644 --- a/tests/Schema/Driver/MySQL/HasOneRelationTest.php +++ b/tests/Schema/Driver/MySQL/HasOneRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class HasOneRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/ManyToManyRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/ManyToManyRelationCompositePKTest.php index 16938ff..9c1f345 100644 --- a/tests/Schema/Driver/MySQL/ManyToManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/ManyToManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\ManyToManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class ManyToManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/ManyToManyRelationTest.php b/tests/Schema/Driver/MySQL/ManyToManyRelationTest.php index 03db223..009ad35 100644 --- a/tests/Schema/Driver/MySQL/ManyToManyRelationTest.php +++ b/tests/Schema/Driver/MySQL/ManyToManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\ManyToManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class ManyToManyRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/MorphedHasManyRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/MorphedHasManyRelationCompositePKTest.php index 3175d07..e4cd7a1 100644 --- a/tests/Schema/Driver/MySQL/MorphedHasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/MorphedHasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class MorphedHasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/MorphedHasManyRelationTest.php b/tests/Schema/Driver/MySQL/MorphedHasManyRelationTest.php index 29d6316..981e650 100644 --- a/tests/Schema/Driver/MySQL/MorphedHasManyRelationTest.php +++ b/tests/Schema/Driver/MySQL/MorphedHasManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class MorphedHasManyRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/MorphedHasOneRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/MorphedHasOneRelationCompositePKTest.php index 84c1229..0c38428 100644 --- a/tests/Schema/Driver/MySQL/MorphedHasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/MorphedHasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class MorphedHasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/MorphedHasOneRelationTest.php b/tests/Schema/Driver/MySQL/MorphedHasOneRelationTest.php index 6251793..fa36a22 100644 --- a/tests/Schema/Driver/MySQL/MorphedHasOneRelationTest.php +++ b/tests/Schema/Driver/MySQL/MorphedHasOneRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class MorphedHasOneRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/PrintChangesTest.php b/tests/Schema/Driver/MySQL/PrintChangesTest.php index ea8c5b4..f86fcc8 100644 --- a/tests/Schema/Driver/MySQL/PrintChangesTest.php +++ b/tests/Schema/Driver/MySQL/PrintChangesTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\PrintChangesTest as BaseTest; -final class PrintChangesTest extends BaseTest +/** + * @group driver + * @group driver-mysql + */ +class PrintChangesTest extends BaseTest { public const DRIVER = 'mysql'; } diff --git a/tests/Schema/Driver/MySQL/RefersToRelationCompositePKTest.php b/tests/Schema/Driver/MySQL/RefersToRelationCompositePKTest.php index c3def31..654d890 100644 --- a/tests/Schema/Driver/MySQL/RefersToRelationCompositePKTest.php +++ b/tests/Schema/Driver/MySQL/RefersToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\RefersToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class RefersToRelationCompositePKTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/RefersToRelationTest.php b/tests/Schema/Driver/MySQL/RefersToRelationTest.php index a432ae9..7276f17 100644 --- a/tests/Schema/Driver/MySQL/RefersToRelationTest.php +++ b/tests/Schema/Driver/MySQL/RefersToRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\RefersToRelationTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class RefersToRelationTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/RegistryTest.php b/tests/Schema/Driver/MySQL/RegistryTest.php index c6b8522..cd5884a 100644 --- a/tests/Schema/Driver/MySQL/RegistryTest.php +++ b/tests/Schema/Driver/MySQL/RegistryTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\RegistryTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class RegistryTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/RenderRelationsTest.php b/tests/Schema/Driver/MySQL/RenderRelationsTest.php index 4803344..e7100c8 100644 --- a/tests/Schema/Driver/MySQL/RenderRelationsTest.php +++ b/tests/Schema/Driver/MySQL/RenderRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\RenderRelationsTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class RenderRelationsTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/ResolveInterfacesTest.php b/tests/Schema/Driver/MySQL/ResolveInterfacesTest.php index d9afc7f..c1d1a3d 100644 --- a/tests/Schema/Driver/MySQL/ResolveInterfacesTest.php +++ b/tests/Schema/Driver/MySQL/ResolveInterfacesTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\ResolveInterfacesTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class ResolveInterfacesTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/TableGeneratorTest.php b/tests/Schema/Driver/MySQL/TableGeneratorTest.php index 1d1b07b..1735889 100644 --- a/tests/Schema/Driver/MySQL/TableGeneratorTest.php +++ b/tests/Schema/Driver/MySQL/TableGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TableGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class TableGeneratorTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/MySQL/TypecastGeneratorTest.php b/tests/Schema/Driver/MySQL/TypecastGeneratorTest.php index cbee7c9..3426021 100644 --- a/tests/Schema/Driver/MySQL/TypecastGeneratorTest.php +++ b/tests/Schema/Driver/MySQL/TypecastGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TypecastGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-mysql + */ class TypecastGeneratorTest extends BaseTest { public const DRIVER = 'mysql'; diff --git a/tests/Schema/Driver/Postgres/BelongsToMorphedRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/BelongsToMorphedRelationCompositePKTest.php index 9595df9..5088162 100644 --- a/tests/Schema/Driver/Postgres/BelongsToMorphedRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/BelongsToMorphedRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class BelongsToMorphedRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/BelongsToMorphedRelationTest.php b/tests/Schema/Driver/Postgres/BelongsToMorphedRelationTest.php index 7f6cf1a..9cda6fb 100644 --- a/tests/Schema/Driver/Postgres/BelongsToMorphedRelationTest.php +++ b/tests/Schema/Driver/Postgres/BelongsToMorphedRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class BelongsToMorphedRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/BelongsToRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/BelongsToRelationCompositePKTest.php index 347e518..6e9e248 100644 --- a/tests/Schema/Driver/Postgres/BelongsToRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/BelongsToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\BelongsToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class BelongsToRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/BelongsToRelationTest.php b/tests/Schema/Driver/Postgres/BelongsToRelationTest.php index 2889948..d63fa39 100644 --- a/tests/Schema/Driver/Postgres/BelongsToRelationTest.php +++ b/tests/Schema/Driver/Postgres/BelongsToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\BelongsToRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class BelongsToRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/ColumnTest.php b/tests/Schema/Driver/Postgres/ColumnTest.php index 80cb524..f307eb1 100644 --- a/tests/Schema/Driver/Postgres/ColumnTest.php +++ b/tests/Schema/Driver/Postgres/ColumnTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\ColumnTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class ColumnTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/EmbeddedTest.php b/tests/Schema/Driver/Postgres/EmbeddedTest.php index 25f6bed..4ad0d1a 100644 --- a/tests/Schema/Driver/Postgres/EmbeddedTest.php +++ b/tests/Schema/Driver/Postgres/EmbeddedTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\EmbeddedTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class EmbeddedTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/ForeignKeysTest.php b/tests/Schema/Driver/Postgres/ForeignKeysTest.php index 931a894..4e65f4e 100644 --- a/tests/Schema/Driver/Postgres/ForeignKeysTest.php +++ b/tests/Schema/Driver/Postgres/ForeignKeysTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\ForeignKeysTest as BaseTest; -final class ForeignKeysTest extends BaseTest +/** + * @group driver + * @group driver-postgres + */ +class ForeignKeysTest extends BaseTest { public const DRIVER = 'postgres'; } diff --git a/tests/Schema/Driver/Postgres/GenerateRelationsTest.php b/tests/Schema/Driver/Postgres/GenerateRelationsTest.php index 9979dc2..875b696 100644 --- a/tests/Schema/Driver/Postgres/GenerateRelationsTest.php +++ b/tests/Schema/Driver/Postgres/GenerateRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\GenerateRelationsTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class GenerateRelationsTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/HasManyRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/HasManyRelationCompositePKTest.php index 93060b6..c079d6a 100644 --- a/tests/Schema/Driver/Postgres/HasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/HasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class HasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/HasManyRelationTest.php b/tests/Schema/Driver/Postgres/HasManyRelationTest.php index 0357f0c..5ab992b 100644 --- a/tests/Schema/Driver/Postgres/HasManyRelationTest.php +++ b/tests/Schema/Driver/Postgres/HasManyRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class HasManyRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/HasOneRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/HasOneRelationCompositePKTest.php index e2bd483..a451379 100644 --- a/tests/Schema/Driver/Postgres/HasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/HasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class HasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/HasOneRelationTest.php b/tests/Schema/Driver/Postgres/HasOneRelationTest.php index 285541f..777a76b 100644 --- a/tests/Schema/Driver/Postgres/HasOneRelationTest.php +++ b/tests/Schema/Driver/Postgres/HasOneRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class HasOneRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/ManyToManyRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/ManyToManyRelationCompositePKTest.php index 8435bdd..1660dd5 100644 --- a/tests/Schema/Driver/Postgres/ManyToManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/ManyToManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\ManyToManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class ManyToManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/ManyToManyRelationTest.php b/tests/Schema/Driver/Postgres/ManyToManyRelationTest.php index 17ec7d8..8729fec 100644 --- a/tests/Schema/Driver/Postgres/ManyToManyRelationTest.php +++ b/tests/Schema/Driver/Postgres/ManyToManyRelationTest.php @@ -16,6 +16,10 @@ use Cycle\Schema\Tests\Fixtures\TagContext; use Cycle\Schema\Tests\Relation\ManyToManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class ManyToManyRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/MorphedHasManyRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/MorphedHasManyRelationCompositePKTest.php index 8b44906..4bcb2c2 100644 --- a/tests/Schema/Driver/Postgres/MorphedHasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/MorphedHasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class MorphedHasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/MorphedHasManyRelationTest.php b/tests/Schema/Driver/Postgres/MorphedHasManyRelationTest.php index d6183a9..2199d98 100644 --- a/tests/Schema/Driver/Postgres/MorphedHasManyRelationTest.php +++ b/tests/Schema/Driver/Postgres/MorphedHasManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class MorphedHasManyRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/MorphedHasOneRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/MorphedHasOneRelationCompositePKTest.php index f38fa9a..ceba385 100644 --- a/tests/Schema/Driver/Postgres/MorphedHasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/MorphedHasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class MorphedHasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/MorphedHasOneRelationTest.php b/tests/Schema/Driver/Postgres/MorphedHasOneRelationTest.php index fa17c7b..fb6f8ae 100644 --- a/tests/Schema/Driver/Postgres/MorphedHasOneRelationTest.php +++ b/tests/Schema/Driver/Postgres/MorphedHasOneRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class MorphedHasOneRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/PrintChangesTest.php b/tests/Schema/Driver/Postgres/PrintChangesTest.php index f9fd3a1..2b481f3 100644 --- a/tests/Schema/Driver/Postgres/PrintChangesTest.php +++ b/tests/Schema/Driver/Postgres/PrintChangesTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\PrintChangesTest as BaseTest; -final class PrintChangesTest extends BaseTest +/** + * @group driver + * @group driver-postgres + */ +class PrintChangesTest extends BaseTest { public const DRIVER = 'postgres'; } diff --git a/tests/Schema/Driver/Postgres/RefersToRelationCompositePKTest.php b/tests/Schema/Driver/Postgres/RefersToRelationCompositePKTest.php index b47669b..7c60771 100644 --- a/tests/Schema/Driver/Postgres/RefersToRelationCompositePKTest.php +++ b/tests/Schema/Driver/Postgres/RefersToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\RefersToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class RefersToRelationCompositePKTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/RefersToRelationTest.php b/tests/Schema/Driver/Postgres/RefersToRelationTest.php index 8314309..2a3f859 100644 --- a/tests/Schema/Driver/Postgres/RefersToRelationTest.php +++ b/tests/Schema/Driver/Postgres/RefersToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\RefersToRelationTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class RefersToRelationTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/RegistryTest.php b/tests/Schema/Driver/Postgres/RegistryTest.php index ef6ee8f..0ef9bc1 100644 --- a/tests/Schema/Driver/Postgres/RegistryTest.php +++ b/tests/Schema/Driver/Postgres/RegistryTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\RegistryTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class RegistryTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/RenderRelationsTest.php b/tests/Schema/Driver/Postgres/RenderRelationsTest.php index b0cce70..154c3e8 100644 --- a/tests/Schema/Driver/Postgres/RenderRelationsTest.php +++ b/tests/Schema/Driver/Postgres/RenderRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\RenderRelationsTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class RenderRelationsTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/ResolveInterfacesTest.php b/tests/Schema/Driver/Postgres/ResolveInterfacesTest.php index 2bddb61..1e7323f 100644 --- a/tests/Schema/Driver/Postgres/ResolveInterfacesTest.php +++ b/tests/Schema/Driver/Postgres/ResolveInterfacesTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\ResolveInterfacesTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class ResolveInterfacesTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/TableGeneratorTest.php b/tests/Schema/Driver/Postgres/TableGeneratorTest.php index 276981c..4613d47 100644 --- a/tests/Schema/Driver/Postgres/TableGeneratorTest.php +++ b/tests/Schema/Driver/Postgres/TableGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TableGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class TableGeneratorTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/Postgres/TypecastGeneratorTest.php b/tests/Schema/Driver/Postgres/TypecastGeneratorTest.php index 1a316ac..159bf51 100644 --- a/tests/Schema/Driver/Postgres/TypecastGeneratorTest.php +++ b/tests/Schema/Driver/Postgres/TypecastGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TypecastGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-postgres + */ class TypecastGeneratorTest extends BaseTest { public const DRIVER = 'postgres'; diff --git a/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationCompositePKTest.php index bb6ce85..ccf874e 100644 --- a/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class BelongsToMorphedRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationTest.php b/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationTest.php index 30d943b..e1775f0 100644 --- a/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationTest.php +++ b/tests/Schema/Driver/SQLServer/BelongsToMorphedRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class BelongsToMorphedRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/BelongsToRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/BelongsToRelationCompositePKTest.php index fe7bba6..fca8832 100644 --- a/tests/Schema/Driver/SQLServer/BelongsToRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/BelongsToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\BelongsToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class BelongsToRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/BelongsToRelationTest.php b/tests/Schema/Driver/SQLServer/BelongsToRelationTest.php index 5f500b8..f331501 100644 --- a/tests/Schema/Driver/SQLServer/BelongsToRelationTest.php +++ b/tests/Schema/Driver/SQLServer/BelongsToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\BelongsToRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class BelongsToRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/ColumnTest.php b/tests/Schema/Driver/SQLServer/ColumnTest.php index e3774d8..f93ac49 100644 --- a/tests/Schema/Driver/SQLServer/ColumnTest.php +++ b/tests/Schema/Driver/SQLServer/ColumnTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\ColumnTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class ColumnTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/EmbeddedTest.php b/tests/Schema/Driver/SQLServer/EmbeddedTest.php index a85f8a4..b652b9e 100644 --- a/tests/Schema/Driver/SQLServer/EmbeddedTest.php +++ b/tests/Schema/Driver/SQLServer/EmbeddedTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\EmbeddedTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class EmbeddedTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/ForeignKeysTest.php b/tests/Schema/Driver/SQLServer/ForeignKeysTest.php index 66bb89e..a046835 100644 --- a/tests/Schema/Driver/SQLServer/ForeignKeysTest.php +++ b/tests/Schema/Driver/SQLServer/ForeignKeysTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\ForeignKeysTest as BaseTest; -final class ForeignKeysTest extends BaseTest +/** + * @group driver + * @group driver-sqlserver + */ +class ForeignKeysTest extends BaseTest { public const DRIVER = 'sqlserver'; } diff --git a/tests/Schema/Driver/SQLServer/GenerateRelationsTest.php b/tests/Schema/Driver/SQLServer/GenerateRelationsTest.php index 387cbe3..2c3cd4f 100644 --- a/tests/Schema/Driver/SQLServer/GenerateRelationsTest.php +++ b/tests/Schema/Driver/SQLServer/GenerateRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\GenerateRelationsTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class GenerateRelationsTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/HasManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/HasManyRelationCompositePKTest.php index e0f708f..408ffbc 100644 --- a/tests/Schema/Driver/SQLServer/HasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/HasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class HasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/HasManyRelationTest.php b/tests/Schema/Driver/SQLServer/HasManyRelationTest.php index ee5703f..776c42c 100644 --- a/tests/Schema/Driver/SQLServer/HasManyRelationTest.php +++ b/tests/Schema/Driver/SQLServer/HasManyRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class HasManyRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/HasOneRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/HasOneRelationCompositePKTest.php index 82b2485..1fef2cf 100644 --- a/tests/Schema/Driver/SQLServer/HasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/HasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class HasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/HasOneRelationTest.php b/tests/Schema/Driver/SQLServer/HasOneRelationTest.php index 9a0d320..8fbd8b6 100644 --- a/tests/Schema/Driver/SQLServer/HasOneRelationTest.php +++ b/tests/Schema/Driver/SQLServer/HasOneRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class HasOneRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/ManyToManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/ManyToManyRelationCompositePKTest.php index 437ed06..258e4f5 100644 --- a/tests/Schema/Driver/SQLServer/ManyToManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/ManyToManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\ManyToManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class ManyToManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/ManyToManyRelationTest.php b/tests/Schema/Driver/SQLServer/ManyToManyRelationTest.php index f542604..0e5004e 100644 --- a/tests/Schema/Driver/SQLServer/ManyToManyRelationTest.php +++ b/tests/Schema/Driver/SQLServer/ManyToManyRelationTest.php @@ -16,6 +16,10 @@ use Cycle\Schema\Tests\Fixtures\TagContext; use Cycle\Schema\Tests\Relation\ManyToManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class ManyToManyRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/MorphedHasManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/MorphedHasManyRelationCompositePKTest.php index 4579301..8f64b4f 100644 --- a/tests/Schema/Driver/SQLServer/MorphedHasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/MorphedHasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class MorphedHasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/MorphedHasManyRelationTest.php b/tests/Schema/Driver/SQLServer/MorphedHasManyRelationTest.php index f271b5b..fcee67a 100644 --- a/tests/Schema/Driver/SQLServer/MorphedHasManyRelationTest.php +++ b/tests/Schema/Driver/SQLServer/MorphedHasManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class MorphedHasManyRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/MorphedHasOneRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/MorphedHasOneRelationCompositePKTest.php index 7d1bc28..4cef169 100644 --- a/tests/Schema/Driver/SQLServer/MorphedHasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/MorphedHasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class MorphedHasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/MorphedHasOneRelationTest.php b/tests/Schema/Driver/SQLServer/MorphedHasOneRelationTest.php index 9b4ed78..3c64ce7 100644 --- a/tests/Schema/Driver/SQLServer/MorphedHasOneRelationTest.php +++ b/tests/Schema/Driver/SQLServer/MorphedHasOneRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class MorphedHasOneRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/PrintChangesTest.php b/tests/Schema/Driver/SQLServer/PrintChangesTest.php index a95e979..bf4f72c 100644 --- a/tests/Schema/Driver/SQLServer/PrintChangesTest.php +++ b/tests/Schema/Driver/SQLServer/PrintChangesTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\PrintChangesTest as BaseTest; -final class PrintChangesTest extends BaseTest +/** + * @group driver + * @group driver-sqlserver + */ +class PrintChangesTest extends BaseTest { public const DRIVER = 'sqlserver'; } diff --git a/tests/Schema/Driver/SQLServer/RefersToRelationCompositePKTest.php b/tests/Schema/Driver/SQLServer/RefersToRelationCompositePKTest.php index b58de61..6230ec7 100644 --- a/tests/Schema/Driver/SQLServer/RefersToRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLServer/RefersToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\RefersToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class RefersToRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/RefersToRelationTest.php b/tests/Schema/Driver/SQLServer/RefersToRelationTest.php index 7e0c7a1..a8ac162 100644 --- a/tests/Schema/Driver/SQLServer/RefersToRelationTest.php +++ b/tests/Schema/Driver/SQLServer/RefersToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\RefersToRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class RefersToRelationTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/RegistryTest.php b/tests/Schema/Driver/SQLServer/RegistryTest.php index 4e4cf67..fbcbd18 100644 --- a/tests/Schema/Driver/SQLServer/RegistryTest.php +++ b/tests/Schema/Driver/SQLServer/RegistryTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\RegistryTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class RegistryTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/RenderRelationsTest.php b/tests/Schema/Driver/SQLServer/RenderRelationsTest.php index e8eeac1..3285394 100644 --- a/tests/Schema/Driver/SQLServer/RenderRelationsTest.php +++ b/tests/Schema/Driver/SQLServer/RenderRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\RenderRelationsTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class RenderRelationsTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/ResolveInterfacesTest.php b/tests/Schema/Driver/SQLServer/ResolveInterfacesTest.php index 55ffd37..c269825 100644 --- a/tests/Schema/Driver/SQLServer/ResolveInterfacesTest.php +++ b/tests/Schema/Driver/SQLServer/ResolveInterfacesTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\ResolveInterfacesTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class ResolveInterfacesTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/TableGeneratorTest.php b/tests/Schema/Driver/SQLServer/TableGeneratorTest.php index ce81c52..5165658 100644 --- a/tests/Schema/Driver/SQLServer/TableGeneratorTest.php +++ b/tests/Schema/Driver/SQLServer/TableGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TableGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class TableGeneratorTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLServer/TypecastGeneratorTest.php b/tests/Schema/Driver/SQLServer/TypecastGeneratorTest.php index efa89bd..89109ba 100644 --- a/tests/Schema/Driver/SQLServer/TypecastGeneratorTest.php +++ b/tests/Schema/Driver/SQLServer/TypecastGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TypecastGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-sqlserver + */ class TypecastGeneratorTest extends BaseTest { public const DRIVER = 'sqlserver'; diff --git a/tests/Schema/Driver/SQLite/BelongsToMorphedRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/BelongsToMorphedRelationCompositePKTest.php index 160495d..30d1f38 100644 --- a/tests/Schema/Driver/SQLite/BelongsToMorphedRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/BelongsToMorphedRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class BelongsToMorphedRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/BelongsToMorphedRelationTest.php b/tests/Schema/Driver/SQLite/BelongsToMorphedRelationTest.php index c79b9e9..45a483b 100644 --- a/tests/Schema/Driver/SQLite/BelongsToMorphedRelationTest.php +++ b/tests/Schema/Driver/SQLite/BelongsToMorphedRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class BelongsToMorphedRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/BelongsToRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/BelongsToRelationCompositePKTest.php index f05fce1..3e492ce 100644 --- a/tests/Schema/Driver/SQLite/BelongsToRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/BelongsToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\BelongsToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class BelongsToRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/BelongsToRelationTest.php b/tests/Schema/Driver/SQLite/BelongsToRelationTest.php index f9ec252..55fe05a 100644 --- a/tests/Schema/Driver/SQLite/BelongsToRelationTest.php +++ b/tests/Schema/Driver/SQLite/BelongsToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\BelongsToRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class BelongsToRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/ColumnTest.php b/tests/Schema/Driver/SQLite/ColumnTest.php index 00d7268..ae5d595 100644 --- a/tests/Schema/Driver/SQLite/ColumnTest.php +++ b/tests/Schema/Driver/SQLite/ColumnTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\ColumnTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class ColumnTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/EmbeddedTest.php b/tests/Schema/Driver/SQLite/EmbeddedTest.php index c276696..3084c7e 100644 --- a/tests/Schema/Driver/SQLite/EmbeddedTest.php +++ b/tests/Schema/Driver/SQLite/EmbeddedTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\EmbeddedTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class EmbeddedTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/ForeignKeysTest.php b/tests/Schema/Driver/SQLite/ForeignKeysTest.php index 656694a..0bc4a03 100644 --- a/tests/Schema/Driver/SQLite/ForeignKeysTest.php +++ b/tests/Schema/Driver/SQLite/ForeignKeysTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\ForeignKeysTest as BaseTest; -final class ForeignKeysTest extends BaseTest +/** + * @group driver + * @group driver-sqlite + */ +class ForeignKeysTest extends BaseTest { public const DRIVER = 'sqlite'; } diff --git a/tests/Schema/Driver/SQLite/GenerateRelationsTest.php b/tests/Schema/Driver/SQLite/GenerateRelationsTest.php index 6ba8ed5..67ef507 100644 --- a/tests/Schema/Driver/SQLite/GenerateRelationsTest.php +++ b/tests/Schema/Driver/SQLite/GenerateRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\GenerateRelationsTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class GenerateRelationsTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/HasManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/HasManyRelationCompositePKTest.php index 4ab90ee..28211a0 100644 --- a/tests/Schema/Driver/SQLite/HasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/HasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class HasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/HasManyRelationTest.php b/tests/Schema/Driver/SQLite/HasManyRelationTest.php index f453f58..6901723 100644 --- a/tests/Schema/Driver/SQLite/HasManyRelationTest.php +++ b/tests/Schema/Driver/SQLite/HasManyRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class HasManyRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/HasOneRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/HasOneRelationCompositePKTest.php index af9b3da..c2a459b 100644 --- a/tests/Schema/Driver/SQLite/HasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/HasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\HasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class HasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/HasOneRelationTest.php b/tests/Schema/Driver/SQLite/HasOneRelationTest.php index 1303f8c..5463d27 100644 --- a/tests/Schema/Driver/SQLite/HasOneRelationTest.php +++ b/tests/Schema/Driver/SQLite/HasOneRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\User; use Cycle\Schema\Tests\Relation\HasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class HasOneRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/ManyToManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/ManyToManyRelationCompositePKTest.php index d066cc8..d289175 100644 --- a/tests/Schema/Driver/SQLite/ManyToManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/ManyToManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\ManyToManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class ManyToManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/ManyToManyRelationTest.php b/tests/Schema/Driver/SQLite/ManyToManyRelationTest.php index 860ec0f..a99b768 100644 --- a/tests/Schema/Driver/SQLite/ManyToManyRelationTest.php +++ b/tests/Schema/Driver/SQLite/ManyToManyRelationTest.php @@ -16,6 +16,10 @@ use Cycle\Schema\Tests\Fixtures\TagContext; use Cycle\Schema\Tests\Relation\ManyToManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class ManyToManyRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/MorphedHasManyRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/MorphedHasManyRelationCompositePKTest.php index 78028f6..2ce2284 100644 --- a/tests/Schema/Driver/SQLite/MorphedHasManyRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/MorphedHasManyRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class MorphedHasManyRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/MorphedHasManyRelationTest.php b/tests/Schema/Driver/SQLite/MorphedHasManyRelationTest.php index 5175073..5de7ff7 100644 --- a/tests/Schema/Driver/SQLite/MorphedHasManyRelationTest.php +++ b/tests/Schema/Driver/SQLite/MorphedHasManyRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasManyRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class MorphedHasManyRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/MorphedHasOneRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/MorphedHasOneRelationCompositePKTest.php index 0d385cd..77d57d9 100644 --- a/tests/Schema/Driver/SQLite/MorphedHasOneRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/MorphedHasOneRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class MorphedHasOneRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/MorphedHasOneRelationTest.php b/tests/Schema/Driver/SQLite/MorphedHasOneRelationTest.php index 9466af9..ef1a356 100644 --- a/tests/Schema/Driver/SQLite/MorphedHasOneRelationTest.php +++ b/tests/Schema/Driver/SQLite/MorphedHasOneRelationTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\Morphed\MorphedHasOneRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class MorphedHasOneRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/PrintChangesTest.php b/tests/Schema/Driver/SQLite/PrintChangesTest.php index 2088099..7a6ad8b 100644 --- a/tests/Schema/Driver/SQLite/PrintChangesTest.php +++ b/tests/Schema/Driver/SQLite/PrintChangesTest.php @@ -6,7 +6,11 @@ use Cycle\Schema\Tests\Generator\PrintChangesTest as BaseTest; -final class PrintChangesTest extends BaseTest +/** + * @group driver + * @group driver-sqlite + */ +class PrintChangesTest extends BaseTest { public const DRIVER = 'sqlite'; } diff --git a/tests/Schema/Driver/SQLite/RefersToRelationCompositePKTest.php b/tests/Schema/Driver/SQLite/RefersToRelationCompositePKTest.php index 28c525e..861c82c 100644 --- a/tests/Schema/Driver/SQLite/RefersToRelationCompositePKTest.php +++ b/tests/Schema/Driver/SQLite/RefersToRelationCompositePKTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Relation\RefersToRelationCompositePKTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class RefersToRelationCompositePKTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/RefersToRelationTest.php b/tests/Schema/Driver/SQLite/RefersToRelationTest.php index 20aba61..b8ed75f 100644 --- a/tests/Schema/Driver/SQLite/RefersToRelationTest.php +++ b/tests/Schema/Driver/SQLite/RefersToRelationTest.php @@ -14,6 +14,10 @@ use Cycle\Schema\Tests\Fixtures\Post; use Cycle\Schema\Tests\Relation\RefersToRelationTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class RefersToRelationTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/RegistryTest.php b/tests/Schema/Driver/SQLite/RegistryTest.php index f6e93cb..9a17f07 100644 --- a/tests/Schema/Driver/SQLite/RegistryTest.php +++ b/tests/Schema/Driver/SQLite/RegistryTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\RegistryTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class RegistryTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/RenderRelationsTest.php b/tests/Schema/Driver/SQLite/RenderRelationsTest.php index bffb034..0d776a2 100644 --- a/tests/Schema/Driver/SQLite/RenderRelationsTest.php +++ b/tests/Schema/Driver/SQLite/RenderRelationsTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\RenderRelationsTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class RenderRelationsTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/ResolveInterfacesTest.php b/tests/Schema/Driver/SQLite/ResolveInterfacesTest.php index 7fb4a52..6e5c18c 100644 --- a/tests/Schema/Driver/SQLite/ResolveInterfacesTest.php +++ b/tests/Schema/Driver/SQLite/ResolveInterfacesTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\ResolveInterfacesTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class ResolveInterfacesTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/TableGeneratorTest.php b/tests/Schema/Driver/SQLite/TableGeneratorTest.php index df21186..a41ae58 100644 --- a/tests/Schema/Driver/SQLite/TableGeneratorTest.php +++ b/tests/Schema/Driver/SQLite/TableGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TableGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class TableGeneratorTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/Schema/Driver/SQLite/TypecastGeneratorTest.php b/tests/Schema/Driver/SQLite/TypecastGeneratorTest.php index 574c7db..d0ddb9d 100644 --- a/tests/Schema/Driver/SQLite/TypecastGeneratorTest.php +++ b/tests/Schema/Driver/SQLite/TypecastGeneratorTest.php @@ -6,6 +6,10 @@ use Cycle\Schema\Tests\Generator\TypecastGeneratorTest as BaseTest; +/** + * @group driver + * @group driver-sqlite + */ class TypecastGeneratorTest extends BaseTest { public const DRIVER = 'sqlite'; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 59648d7..b23e6b9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -27,7 +27,7 @@ host: '127.0.0.1', port: 13306, user: 'root', - password: 'root', + password: 'YourStrong!Passw0rd', ), queryCache: true, ), @@ -37,7 +37,7 @@ host: '127.0.0.1', port: 15432, user: 'postgres', - password: 'postgres', + password: 'YourStrong!Passw0rd', ), schema: 'public', queryCache: true, @@ -48,7 +48,7 @@ host: '127.0.0.1', port: 11433, user: 'SA', - password: 'SSpaSS__1', + password: 'YourStrong!Passw0rd', ), queryCache: true, ), diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 9f2eb69..31de9c4 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -4,7 +4,7 @@ services: ports: - "11433:1433" environment: - SA_PASSWORD: "SSpaSS__1" + SA_PASSWORD: "YourStrong!Passw0rd" ACCEPT_EULA: "Y" mysql: @@ -14,7 +14,7 @@ services: - "13306:3306" environment: MYSQL_DATABASE: "spiral" - MYSQL_ROOT_PASSWORD: "root" + MYSQL_ROOT_PASSWORD: "YourStrong!Passw0rd" MYSQL_ROOT_HOST: "%" postgres: @@ -24,4 +24,4 @@ services: environment: POSTGRES_DB: "spiral" POSTGRES_USER: "postgres" - POSTGRES_PASSWORD: "postgres" \ No newline at end of file + POSTGRES_PASSWORD: "YourStrong!Passw0rd" diff --git a/tests/generate.php b/tests/generate.php index f98f3bf..6975e31 100644 --- a/tests/generate.php +++ b/tests/generate.php @@ -53,6 +53,9 @@ echo "Found {$class->getName()}\n"; foreach ($databases as $driver => $details) { $filename = sprintf('%s/%s.php', $details['directory'], $class->getShortName()); + if (\file_exists($filename)) { + continue; + } $baseTestName = 'BaseTest'; file_put_contents( @@ -66,6 +69,10 @@ use %s; +/** + * @group driver + * @group driver-%s + */ class %s extends %s { public const DRIVER = '%s'; @@ -73,6 +80,7 @@ class %s extends %s ", $details['namespace'], $class->getName() . ' as ' . $baseTestName, + $driver, $class->getShortName(), $baseTestName, $driver, From e98bb5e7f993544c26c10bd96cab3bf0bc795ebf Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 13 Dec 2024 19:47:10 +0400 Subject: [PATCH 4/4] psalm: suppress MissingClassConstType --- psalm.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/psalm.xml b/psalm.xml index ff8743a..672dba5 100644 --- a/psalm.xml +++ b/psalm.xml @@ -12,4 +12,7 @@ + + +