diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..758f712 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: + - master + - cake5 + pull_request: + branches: + - '*' + +permissions: + contents: read + +jobs: + testsuite: + uses: cakephp/.github/.github/workflows/testsuite-with-db.yml@5.x + secrets: inherit + + cs-stan: + uses: cakephp/.github/.github/workflows/cs-stan.yml@5.x + secrets: inherit diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..9aa6dfe --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c163a28..0000000 --- a/.travis.yml +++ /dev/null @@ -1,58 +0,0 @@ -language: php - -php: - - 7.2 - - 7.3 - - 7.4 - -services: - - mysql - - postgresql - -env: - matrix: - - DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test' - - DB=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test' - - DB=sqlite db_dsn='sqlite:///:memory:' - - global: - - DEFAULT=1 - -services: - - mysql - - postgresql - -matrix: - fast_finish: true - - include: - - php: 7.3 - env: PHPCS=1 DEFAULT=0 - - - php: 7.3 - env: STATIC_ANALYSIS=1 DEFAULT=0 - -before_script: - - if [[ $TRAVIS_PHP_VERSION != 7.2 ]]; then phpenv config-rm xdebug.ini; fi - - - if [[ $PREFER_LOWEST != 1 ]]; then composer update --no-interaction; fi - - if [[ $PREFER_LOWEST == 1 ]]; then composer update --no-interaction --prefer-lowest --prefer-stable; fi - - - if [[ $DB = 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi - - if [[ $DB = 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi - - - if [[ $PHPCS == 1 ]]; then composer require cakephp/cakephp-codesniffer:^4.0; fi - - if [[ $STATIC_ANALYSIS == 1 ]]; then composer require --dev phpstan/phpstan:^0.12 psalm/phar:^3.8; fi - -script: - - if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION != 7.2 ]]; then vendor/bin/phpunit; fi - - - if [[ $PHPCS == 1 ]]; then vendor/bin/phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi - - - if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/phpstan.phar analyse src && vendor/bin/psalm.phar --show-info=false; fi - -after_success: - - if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION == 7.2 ]]; then bash <(curl -s https://codecov.io/bash); fi - -notifications: - email: false diff --git a/README.md b/README.md index 79cb51f..3b9e762 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ bin/cake plugin load Muffin/Tags or by manually adding the following line to `src/Application.php`: ```php -$this->addPlugin('Muffin/Obfuscate'); +$this->addPlugin('Muffin/Tags'); ``` ## Usage diff --git a/composer.json b/composer.json index 33ed284..caa3ab6 100644 --- a/composer.json +++ b/composer.json @@ -30,13 +30,15 @@ "source": "https://github.com/usemuffin/tags" }, "require": { - "cakephp/orm": "^4.0", - "cakephp/utility": "^4.0" + "cakephp/orm": "^5.0.0", + "cakephp/utility": "^5.0.0" }, "require-dev": { - "cakephp/cakephp": "^4.0", - "cakephp/cakephp-codesniffer": "^4.0", - "phpunit/phpunit": "~8.5.0" + "cakephp/cakephp": "^5.0.0", + "cakephp/cakephp-codesniffer": "^5.0", + "cakephp/migrations": "^4.0.0", + "phpunit/phpunit": "^10.1.0", + "vimeo/psalm": "^5.15" }, "suggest": { "muffin/slug": "For adding slugs to tags" @@ -53,6 +55,23 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "scripts": { + "cs-check": "phpcs --colors --parallel=16 -p src/ tests/", + "cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/", + "phpstan": "tools/phpstan analyse", + "psalm": "tools/psalm --show-info=false", + "stan": [ + "@phpstan", + "@psalm" + ], + "stan-baseline": "tools/phpstan --generate-baseline", + "psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml", + "stan-setup": "phive install", + "test": "phpunit" } } diff --git a/config/Migrations/20150412195500_create_tags_tags.php b/config/Migrations/20150412195500_create_tags_tags.php index bcaadf6..9be0e46 100644 --- a/config/Migrations/20150412195500_create_tags_tags.php +++ b/config/Migrations/20150412195500_create_tags_tags.php @@ -4,7 +4,7 @@ class CreateTagsTags extends AbstractMigration { - public function change() + public function change(): void { $table = $this->table('tags_tags'); diff --git a/config/Migrations/20150412195501_create_tags_tagged.php b/config/Migrations/20150412195501_create_tags_tagged.php index f6c134a..aeaa347 100644 --- a/config/Migrations/20150412195501_create_tags_tagged.php +++ b/config/Migrations/20150412195501_create_tags_tagged.php @@ -4,7 +4,7 @@ class CreateTagsTagged extends AbstractMigration { - public function change() + public function change(): void { $table = $this->table('tags_tagged'); diff --git a/config/Migrations/20151013144821_unique_tags.php b/config/Migrations/20151013144821_unique_tags.php index 9d416d4..d7e79c0 100644 --- a/config/Migrations/20151013144821_unique_tags.php +++ b/config/Migrations/20151013144821_unique_tags.php @@ -25,7 +25,7 @@ class UniqueTags extends AbstractMigration * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function change(): void { $table = $this->table('tags_tags'); diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..b81fdbf --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/phpstan.neon b/phpstan.neon index a03c486..c4a9670 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,3 +2,5 @@ parameters: level: 6 checkGenericClassInNonGenericObjectType: false checkMissingIterableValueType: false + paths: + - src/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e6a1378..ebfe280 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,22 @@ - - + + + + + + + - ./tests/ + tests/TestCase/ - - - - - - - - - - - - - ./src/ - - + + + + + + src/ + + diff --git a/src/Model/Behavior/TagBehavior.php b/src/Model/Behavior/TagBehavior.php index 6987da1..5e9cbcd 100644 --- a/src/Model/Behavior/TagBehavior.php +++ b/src/Model/Behavior/TagBehavior.php @@ -19,9 +19,9 @@ class TagBehavior extends Behavior * - delimiter: The delimiter used to explode() the tags. Default is comma. * - separator: Namespace separator, by default semicolon. * - * @var array + * @var array */ - protected $_defaultConfig = [ + protected array $_defaultConfig = [ 'delimiter' => ',', 'separator' => ':', 'namespace' => null, @@ -65,7 +65,7 @@ public function initialize(array $config): void /** * Return lists of event's this behavior is interested in. * - * @return array Events list. + * @return array Events list. */ public function implementedEvents(): array { @@ -80,7 +80,7 @@ public function implementedEvents(): array * @param \ArrayObject $options Options. * @return void */ - public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options) + public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void { $field = $this->getConfig('tagsAssoc.propertyName'); if (!empty($data[$field]) && (!is_array($data[$field]) || !array_key_exists('_ids', $data[$field]))) { @@ -192,7 +192,6 @@ public function attachCounters(): void } if (!$counterCache->getConfig($taggedAlias)) { - $field = key($config['taggedCounter']); $config['taggedCounter']['tag_count']['conditions'] = [ $taggedTable->aliasField($this->getConfig('fkTableField')) => $this->_table->getTable(), ]; @@ -206,7 +205,7 @@ public function attachCounters(): void * @param array|string $tags List of tags as an array or a delimited string (comma by default). * @return array Normalized tags valid to be marshaled. */ - public function normalizeTags($tags): array + public function normalizeTags(array|string $tags): array { if (is_string($tags)) { $tags = explode($this->getConfig('delimiter'), $tags); @@ -237,6 +236,7 @@ public function normalizeTags($tags): array } [$id, $label] = $this->_normalizeTag($tag); $result[] = $common + compact(empty($id) ? $df : $pk) + [ + 'label' => $label, 'tag_key' => $tagKey, ]; } @@ -259,7 +259,7 @@ protected function _getTagKey(string $tag): string * Checks if a tag already exists and returns the id if yes. * * @param string $tag Tag key. - * @return null|int + * @return int|null */ protected function _tagExists(string $tag): ?int { @@ -291,7 +291,8 @@ protected function _normalizeTag(string $tag): array $namespace = ''; $label = $tag; $separator = $this->getConfig('separator'); - if (strpos($tag, $separator) !== false) { + if (str_contains($tag, $separator)) { + /** @psalm-suppress ArgumentTypeCoercion */ [$namespace, $label] = explode($separator, $tag); } diff --git a/src/Model/Entity/Tag.php b/src/Model/Entity/Tag.php index 96a36d1..865d73e 100644 --- a/src/Model/Entity/Tag.php +++ b/src/Model/Entity/Tag.php @@ -12,7 +12,7 @@ class Tag extends Entity * * @var array */ - public $accessible = [ + public array $accessible = [ '*' => false, 'label' => true, ]; diff --git a/src/Model/Entity/TagAwareTrait.php b/src/Model/Entity/TagAwareTrait.php index 8a104d4..bbd7f8e 100644 --- a/src/Model/Entity/TagAwareTrait.php +++ b/src/Model/Entity/TagAwareTrait.php @@ -3,6 +3,7 @@ namespace Muffin\Tags\Model\Entity; +use Cake\Datasource\EntityInterface; use Cake\ORM\TableRegistry; trait TagAwareTrait @@ -10,11 +11,11 @@ trait TagAwareTrait /** * Tag entity with given tags. * - * @param string|array $tags List of tags as an array or a delimited string (comma by default). + * @param array|string $tags List of tags as an array or a delimited string (comma by default). * @param bool $merge Whether to merge or replace tags. Default true. - * @return bool|\Cake\ORM\Entity False on failure, entity on success. + * @return \Cake\Datasource\EntityInterface|bool False on failure, entity on success. */ - public function tag($tags, bool $merge = true) + public function tag(array|string $tags, bool $merge = true): EntityInterface|bool { return $this->_updateTags($tags, $merge ? 'append' : 'replace'); } @@ -22,11 +23,11 @@ public function tag($tags, bool $merge = true) /** * Untag entity from given tags. * - * @param string|array|null $tags List of tags as an array or a delimited string (comma by default). + * @param array|string|null $tags List of tags as an array or a delimited string (comma by default). * If no value is passed all tags will be removed. - * @return bool|\Cake\ORM\Entity False on failure, entity on success. + * @return \Cake\Datasource\EntityInterface|bool False on failure, entity on success. */ - public function untag($tags = null) + public function untag(array|string|null $tags = null): EntityInterface|bool { if (empty($tags)) { return $this->_updateTags([], 'replace'); @@ -41,8 +42,9 @@ public function untag($tags = null) $tags = $this->get($property); if (!$tags) { - $contain = [$behavior->getConfig('tagsAlias')]; - $tags = $table->get($id, compact('contain'))->get($property); + $tags = $table + ->get(primaryKey: $id, contain: [$behavior->getConfig('tagsAlias')]) + ->get($property); } $tagsTable = $table->{$behavior->getConfig('tagsAlias')}; @@ -81,12 +83,12 @@ function ($i) { /** * Tag entity with given tags. * - * @param string|array $tags List of tags as an array or a delimited string (comma by default). + * @param array|string $tags List of tags as an array or a delimited string (comma by default). * @param string $saveStrategy Whether to merge or replace tags. * Valid values 'append', 'replace'. - * @return bool|\Cake\ORM\Entity False on failure, entity on success. + * @return \Cake\Datasource\EntityInterface|bool False on failure, entity on success. */ - protected function _updateTags($tags, string $saveStrategy) + protected function _updateTags(array|string $tags, string $saveStrategy): EntityInterface|bool { $table = TableRegistry::getTableLocator()->get($this->source()); $behavior = $table->behaviors()->Tag; diff --git a/src/Model/Entity/Tagged.php b/src/Model/Entity/Tagged.php index eb26044..d290806 100644 --- a/src/Model/Entity/Tagged.php +++ b/src/Model/Entity/Tagged.php @@ -15,7 +15,7 @@ class Tagged extends Entity * * @var array */ - public $accessible = [ + public array $accessible = [ '*' => false, ]; } diff --git a/src/Plugin.php b/src/TagsPlugin.php similarity index 61% rename from src/Plugin.php rename to src/TagsPlugin.php index da71012..506b052 100644 --- a/src/Plugin.php +++ b/src/TagsPlugin.php @@ -8,33 +8,33 @@ /** * Plugin class for tags */ -class Plugin extends BasePlugin +class TagsPlugin extends BasePlugin { /** * Plugin name. * - * @var string + * @var string|null */ - protected $name = 'Tags'; + protected ?string $name = 'Tags'; /** * Do bootstrapping or not * * @var bool */ - protected $bootstrapEnabled = false; + protected bool $bootstrapEnabled = false; /** * Load routes or not * * @var bool */ - protected $routesEnabled = false; + protected bool $routesEnabled = false; /** * Console middleware * * @var bool */ - protected $consoleEnabled = false; + protected bool $consoleEnabled = false; } diff --git a/tests/Fixture/BunsFixture.php b/tests/Fixture/BunsFixture.php index 9b74bc9..38688ef 100644 --- a/tests/Fixture/BunsFixture.php +++ b/tests/Fixture/BunsFixture.php @@ -7,18 +7,9 @@ class BunsFixture extends TestFixture { - public $table = 'tags_buns'; + public string $table = 'tags_buns'; - public $fields = [ - 'id' => ['type' => 'integer'], - 'name' => ['type' => 'string', 'length' => 255], - 'tag_count' => ['type' => 'integer', 'null' => true, 'default' => 0], - '_constraints' => [ - 'primary' => ['type' => 'primary', 'columns' => ['id']], - ], - ]; - - public $records = [ + public array $records = [ [ 'name' => 'square', 'tag_count' => 1, diff --git a/tests/Fixture/MuffinsFixture.php b/tests/Fixture/MuffinsFixture.php index 6dfb028..977002a 100644 --- a/tests/Fixture/MuffinsFixture.php +++ b/tests/Fixture/MuffinsFixture.php @@ -7,18 +7,9 @@ class MuffinsFixture extends TestFixture { - public $table = 'tags_muffins'; + public string $table = 'tags_muffins'; - public $fields = [ - 'id' => ['type' => 'integer'], - 'name' => ['type' => 'string', 'length' => 255], - 'tag_count' => ['type' => 'integer', 'null' => true, 'default' => 0], - '_constraints' => [ - 'primary' => ['type' => 'primary', 'columns' => ['id']], - ], - ]; - - public $records = [ + public array $records = [ [ 'name' => 'blue', 'tag_count' => 2, diff --git a/tests/Fixture/TaggedFixture.php b/tests/Fixture/TaggedFixture.php index 1471966..273d43d 100644 --- a/tests/Fixture/TaggedFixture.php +++ b/tests/Fixture/TaggedFixture.php @@ -7,21 +7,9 @@ class TaggedFixture extends TestFixture { - public $table = 'tags_tagged'; + public string $table = 'tags_tagged'; - public $fields = [ - 'id' => ['type' => 'integer'], - 'tag_id' => ['type' => 'integer', 'null' => false], - 'fk_id' => ['type' => 'integer', 'null' => false], - 'fk_table' => ['type' => 'string', 'limit' => 255, 'null' => false], - 'created' => ['type' => 'datetime', 'null' => true], - 'modified' => ['type' => 'datetime', 'null' => true], - '_constraints' => [ - 'primary' => ['type' => 'primary', 'columns' => ['id']], - ], - ]; - - public $records = [ + public array $records = [ [ 'tag_id' => 1, 'fk_id' => 1, diff --git a/tests/Fixture/TagsFixture.php b/tests/Fixture/TagsFixture.php index 6f43963..69738e1 100644 --- a/tests/Fixture/TagsFixture.php +++ b/tests/Fixture/TagsFixture.php @@ -7,23 +7,9 @@ class TagsFixture extends TestFixture { - public $table = 'tags_tags'; + public string $table = 'tags_tags'; - public $fields = [ - 'id' => ['type' => 'integer'], - 'namespace' => ['type' => 'string', 'length' => 255, 'null' => true], - 'tag_key' => ['type' => 'string', 'length' => 255], - 'slug' => ['type' => 'string', 'length' => 255], - 'label' => ['type' => 'string', 'length' => 255], - 'counter' => ['type' => 'integer', 'unsigned' => true, 'default' => 0, 'null' => true], - 'created' => ['type' => 'datetime', 'null' => true], - 'modified' => ['type' => 'datetime', 'null' => true], - '_constraints' => [ - 'primary' => ['type' => 'primary', 'columns' => ['id']], - ], - ]; - - public $records = [ + public array $records = [ [ 'namespace' => null, 'tag_key' => 'color', diff --git a/tests/TestCase/Model/Behavior/TagBehaviorTest.php b/tests/TestCase/Model/Behavior/TagBehaviorTest.php index 03f2ee1..e827ed6 100644 --- a/tests/TestCase/Model/Behavior/TagBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/TagBehaviorTest.php @@ -3,12 +3,12 @@ namespace Muffin\Tags\Test\TestCase\Model\Behavior; -use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; +use RuntimeException; class TagBehaviorTest extends TestCase { - public $fixtures = [ + public array $fixtures = [ 'plugin.Muffin/Tags.Buns', 'plugin.Muffin/Tags.Muffins', 'plugin.Muffin/Tags.Tagged', @@ -19,7 +19,7 @@ public function setUp(): void { parent::setUp(); - $table = TableRegistry::getTableLocator()->get('Muffin/Tags.Muffins', ['table' => 'tags_muffins']); + $table = $this->getTableLocator()->get('Muffin/Tags.Muffins', ['table' => 'tags_muffins']); $table->addBehavior('Muffin/Tags.Tag'); $this->Table = $table; @@ -29,7 +29,7 @@ public function setUp(): void public function tearDown(): void { parent::tearDown(); - TableRegistry::getTableLocator()->clear(); + $this->getTableLocator()->clear(); unset($this->Behavior); } @@ -88,6 +88,7 @@ public function testNormalizeTags(): void ], 'id' => '3', 'tag_key' => '3-foobar', + 'label' => 'foobar', ], 2 => [ '_joinData' => [ @@ -254,9 +255,9 @@ public function testCounterCacheDisabled(): void public function testCounterCacheFieldException(): void { - $this->expectException(\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Field "non_existent" does not exist in table "tags_buns"'); - $table = TableRegistry::getTableLocator()->get('Muffin/Tags.Buns', ['table' => 'tags_buns']); + $table = $this->getTableLocator()->get('Muffin/Tags.Buns', ['table' => 'tags_buns']); $table->addBehavior('Muffin/Tags.Tag', [ 'taggedCounter' => [ 'non_existent' => [], @@ -266,6 +267,6 @@ public function testCounterCacheFieldException(): void public function testAssociationConditionsAreWorkingAsExpected(): void { - $this->assertEquals(2, count($this->Table->get(1, ['contain' => ['Tags']])->tags)); + $this->assertEquals(2, count($this->Table->get(primaryKey: 1, contain: ['Tags'])->tags)); } } diff --git a/tests/TestCase/Model/Entity/TagAwareTraitTest.php b/tests/TestCase/Model/Entity/TagAwareTraitTest.php index 719690a..ebaa44c 100644 --- a/tests/TestCase/Model/Entity/TagAwareTraitTest.php +++ b/tests/TestCase/Model/Entity/TagAwareTraitTest.php @@ -3,13 +3,12 @@ namespace Muffin\Tags\Test\TestCase\Model\Entity; -use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; use Muffin\Tags\Test\App\Model\Entity\TagsMuffin; class TagAwareTraitTest extends TestCase { - public $fixtures = [ + public array $fixtures = [ 'plugin.Muffin/Tags.Muffins', 'plugin.Muffin/Tags.Tagged', 'plugin.Muffin/Tags.Tags', @@ -19,7 +18,7 @@ public function setUp(): void { parent::setUp(); - $table = TableRegistry::getTableLocator()->get('Muffin/Tags.Muffins', ['table' => 'tags_muffins']); + $table = $this->getTableLocator()->get('Muffin/Tags.Muffins', ['table' => 'tags_muffins']); $table->addBehavior('Muffin/Tags.Tag'); $this->Table = $table; @@ -29,7 +28,7 @@ public function setUp(): void public function tearDown(): void { parent::tearDown(); - TableRegistry::getTableLocator()->clear(); + $this->getTableLocator()->clear(); unset($this->Behavior); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index dd773bd..a69bf3b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,12 +1,19 @@ add(new TagsPlugin()); + +// Create test database schema +if (env('FIXTURE_SCHEMA_METADATA')) { + $loader = new SchemaLoader(); + $loader->loadInternalFile(env('FIXTURE_SCHEMA_METADATA')); +} diff --git a/tests/schema.php b/tests/schema.php new file mode 100644 index 0000000..f7f2ee1 --- /dev/null +++ b/tests/schema.php @@ -0,0 +1,53 @@ + [ + 'columns' => [ + 'id' => ['type' => 'integer'], + 'name' => ['type' => 'string', 'length' => 255], + 'tag_count' => ['type' => 'integer', 'null' => true, 'default' => 0], + ], + 'constraints' => [ + 'primary' => ['type' => 'primary', 'columns' => ['id']], + ], + ], + 'tags_muffins' => [ + 'columns' => [ + 'id' => ['type' => 'integer'], + 'name' => ['type' => 'string', 'length' => 255], + 'tag_count' => ['type' => 'integer', 'null' => true, 'default' => 0], + ], + 'constraints' => [ + 'primary' => ['type' => 'primary', 'columns' => ['id']], + ], + ], + 'tags_tagged' => [ + 'columns' => [ + 'id' => ['type' => 'integer'], + 'tag_id' => ['type' => 'integer', 'null' => false], + 'fk_id' => ['type' => 'integer', 'null' => false], + 'fk_table' => ['type' => 'string', 'limit' => 255, 'null' => false], + 'created' => ['type' => 'datetime', 'null' => true], + 'modified' => ['type' => 'datetime', 'null' => true], + ], + 'constraints' => [ + 'primary' => ['type' => 'primary', 'columns' => ['id']], + ], + ], + 'tags_tags' => [ + 'columns' => [ + 'id' => ['type' => 'integer'], + 'namespace' => ['type' => 'string', 'length' => 255, 'null' => true], + 'tag_key' => ['type' => 'string', 'length' => 255], + 'slug' => ['type' => 'string', 'length' => 255], + 'label' => ['type' => 'string', 'length' => 255], + 'counter' => ['type' => 'integer', 'unsigned' => true, 'default' => 0, 'null' => true], + 'created' => ['type' => 'datetime', 'null' => true], + 'modified' => ['type' => 'datetime', 'null' => true], + ], + 'constraints' => [ + 'primary' => ['type' => 'primary', 'columns' => ['id']], + ], + ], +]; diff --git a/tests/test_app/src/Application.php b/tests/test_app/src/Application.php index 2a76d44..e57d5c4 100644 --- a/tests/test_app/src/Application.php +++ b/tests/test_app/src/Application.php @@ -4,7 +4,12 @@ namespace Muffin\Tags\Test\App; use Cake\Http\BaseApplication; +use Cake\Http\MiddlewareQueue; class Application extends BaseApplication { + public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue + { + return $middlewareQueue; + } } diff --git a/tests/test_app/src/Model/Entity/TagsMuffin.php b/tests/test_app/src/Model/Entity/TagsMuffin.php index 126d09c..bad8af1 100644 --- a/tests/test_app/src/Model/Entity/TagsMuffin.php +++ b/tests/test_app/src/Model/Entity/TagsMuffin.php @@ -10,7 +10,7 @@ class TagsMuffin extends Entity { use TagAwareTrait; - public function source($source = null) + public function source($source = null): string { return 'Muffin/Tags.Muffins'; }