From 4c6fa2e04a61c007c40693d3e264a2f8dc3d1162 Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 24 Feb 2020 23:59:43 +0530 Subject: [PATCH 1/3] Fix deprecation warnings --- src/Model/Table/TagsTable.php | 6 +++++- tests/bootstrap.php | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Model/Table/TagsTable.php b/src/Model/Table/TagsTable.php index 8f2b849..ae52218 100644 --- a/src/Model/Table/TagsTable.php +++ b/src/Model/Table/TagsTable.php @@ -18,7 +18,11 @@ public function initialize(array $config) $this->setTable('tags_tags'); $this->setDisplayField('label'); $this->addBehavior('Timestamp'); - if (Plugin::loaded('Muffin/Slug')) { + $method = 'isLoaded'; + if (!method_exists(Plugin::class, 'isLoaded')) { + $method = 'loaded'; + } + if (Plugin::{$method}('Muffin/Slug')) { $this->addBehavior('Muffin/Slug.Slug'); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 53f22e7..90bdc1a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -30,5 +30,3 @@ } require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php'; - -\Cake\Core\Plugin::load('Muffin/Tags', ['path' => dirname(dirname(__FILE__)) . DS]); From 111e7eaad072c2fc5a518cc1afda6cdb20da76ad Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 25 Feb 2020 00:03:16 +0530 Subject: [PATCH 2/3] Fix travis config --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6fb2cd8..4e8216a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ php: - 7.1 - 7.2 +services: + - mysql + - postgresql + env: matrix: - DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test' @@ -37,7 +41,7 @@ before_script: - if [[ $DB = 'mysql' ]]; then mysql -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; fi + - if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:^3.0; fi - if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan; fi script: From fc3ce91d81fe18b40919f8dda3a0a0be024cec98 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 25 Feb 2020 00:14:38 +0530 Subject: [PATCH 3/3] Fix CS error --- src/Model/Entity/TagAwareTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Model/Entity/TagAwareTrait.php b/src/Model/Entity/TagAwareTrait.php index 309d31d..90ef16d 100644 --- a/src/Model/Entity/TagAwareTrait.php +++ b/src/Model/Entity/TagAwareTrait.php @@ -57,7 +57,8 @@ public function untag($tags = null) foreach ($untags as $untag) { foreach ($tags as $k => $tag) { - if ((empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) && + if ( + (empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) && (empty($untag[$df]) || $tag[$df] === $untag[$df]) ) { unset($tags[$k]);