From 0943f9148e25835baf7ca44e7d97c14ca960f951 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 15:49:02 -0600 Subject: [PATCH 1/8] REFACTOR CMS5 compatibility --- composer.json | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 49a8371..e794922 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,8 @@ { "name": "dynamic/flexslider", "description": "Display a FlexSlider on pages of your website", - "authors": [ - { - "name": "Dynamic", - "homepage": "http://www.dynamicagency.com", - "email": "dev@dynamicagency.com" - } - ], + "license": "BSD-3-Clause", + "type": "silverstripe-vendormodule", "keywords": [ "silverstripe", "flexslider", @@ -16,38 +11,43 @@ "slider", "jquery" ], - "license": "BSD-3-Clause", - "type": "silverstripe-vendormodule", + "authors": [ + { + "name": "Dynamic", + "email": "dev@dynamicagency.com", + "homepage": "https://www.dynamicagency.com" + } + ], "require": { - "silverstripe/recipe-cms": "^4.0", - "dynamic/silverstripe-linkable": "^1.0", - "symbiote/silverstripe-gridfieldextensions": "^3.0" + "dynamic/silverstripe-linkable": "^2.0", + "silverstripe/recipe-cms": "^5.0", + "symbiote/silverstripe-gridfieldextensions": "^4.0" }, "require-dev": { - "silverstripe/recipe-testing": "^2", - "squizlabs/php_codesniffer": "^3.0" + "silverstripe/recipe-testing": "^3", + "squizlabs/php_codesniffer": "^3" }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { "Dynamic\\FlexSlider\\": "src/", "Dynamic\\FlexSlider\\Test\\": "tests/" } }, - "minimum-stability": "dev", - "prefer-stable": true, + "config": { + "allow-plugins": { + "composer/installers": true, + "silverstripe/recipe-plugin": true, + "silverstripe/vendor-plugin": true + }, + "process-timeout": 600 + }, "extra": { "expose": [ "css", "images", "thirdparty" ] - }, - "config": { - "process-timeout": 600, - "allow-plugins": { - "composer/installers": true, - "silverstripe/recipe-plugin": true, - "silverstripe/vendor-plugin": true - } - } + } } From 841afae87d98470216d9b9fafbc352b535a8ebe6 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 15:57:36 -0600 Subject: [PATCH 2/8] workflow update --- .github/workflows/ci.yml | 74 +++------------------------------------- 1 file changed, 5 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a86de3..bf02210 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,75 +1,11 @@ -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +name: CI on: push: - branches: [ '**' ] pull_request: - branches: [ '**' ] - -name: "CI" + workflow_dispatch: jobs: - tests: - name: "Tests" - - runs-on: "ubuntu-latest" - - env: - php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip - - services: - mysql: - image: "mysql:5.7" - env: - MYSQL_ALLOW_EMPTY_PASSWORD: true - MYSQL_ROOT_PASSWORD: - MYSQL_DATABASE: test_db - ports: - - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - - strategy: - fail-fast: false - matrix: - php-version: - - "7.4" - - "8.0" - - "8.1" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.php_extensions }}" - coverage: "xdebug" - - - name: "Start mysql service" - run: "sudo /etc/init.d/mysql start" - - - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1" - with: - path: "~/.composer/cache" - 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" - run: "composer install --no-ansi --no-interaction --no-progress" - - - name: "Run tests with phpunit/phpunit" - env: - SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }} - run: "vendor/bin/phpunit --coverage-clover=coverage.xml" - - - name: "Upload coverage results to CodeCov" - uses: codecov/codecov-action@v1 - with: - files: ./coverage.xml # optional - flags: unittests # optional - - - name: "Run tests with squizlabs/php_codesniffer" - run: "vendor/bin/phpcs -s --report=summary --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/" + ci: + name: CI + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 From 0b0b69c74cbdb76f43111310e33b0e570619cf5d Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 16:03:24 -0600 Subject: [PATCH 3/8] composer requirements update --- composer.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index e794922..d87531a 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,12 @@ } ], "require": { - "dynamic/silverstripe-linkable": "^2.0", - "silverstripe/recipe-cms": "^5.0", - "symbiote/silverstripe-gridfieldextensions": "^4.0" + "dynamic/silverstripe-linkable": "^2", + "silverstripe/recipe-cms": "^5", + "symbiote/silverstripe-gridfieldextensions": "^4" }, "require-dev": { - "silverstripe/recipe-testing": "^3", - "squizlabs/php_codesniffer": "^3" + "silverstripe/recipe-testing": "^3" }, "minimum-stability": "dev", "prefer-stable": true, From 7fefda83d21f714c6290b8c07876ffea2b173da8 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 16:20:11 -0600 Subject: [PATCH 4/8] Linkable version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d87531a..b562eb5 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "dynamic/silverstripe-linkable": "^2", + "dynamic/silverstripe-linkable": "dev-master", "silverstripe/recipe-cms": "^5", "symbiote/silverstripe-gridfieldextensions": "^4" }, From 8f7aef28dcedf22b37b762285b89c5db5fd068e4 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 16:23:42 -0600 Subject: [PATCH 5/8] vcs --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b562eb5..e94914e 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,19 @@ } ], "require": { - "dynamic/silverstripe-linkable": "dev-master", + "dynamic/silverstripe-linkable": "^2.0", "silverstripe/recipe-cms": "^5", "symbiote/silverstripe-gridfieldextensions": "^4" }, "require-dev": { "silverstripe/recipe-testing": "^3" }, + "repositories": { + "dynamic/silverstripe-linkable": { + "type": "vcs", + "url": "git@github.com:dynamic/silverstripe-linkable.git" + } + }, "minimum-stability": "dev", "prefer-stable": true, "autoload": { From 27e7bb9ac9ecf1b425f2e6694709c16f5698664f Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 16:26:43 -0600 Subject: [PATCH 6/8] linkable dev-master --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e94914e..9816e35 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "dynamic/silverstripe-linkable": "^2.0", + "dynamic/silverstripe-linkable": "^2", "silverstripe/recipe-cms": "^5", "symbiote/silverstripe-gridfieldextensions": "^4" }, From 43d551665ebda75785e72ec446533015704616cd Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 16:34:38 -0600 Subject: [PATCH 7/8] linkable version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9816e35..8190c58 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "dynamic/silverstripe-linkable": "^2", + "dynamic/silverstripe-linkable": "dev-master", "silverstripe/recipe-cms": "^5", "symbiote/silverstripe-gridfieldextensions": "^4" }, From 63656fe3eb13454d61c0647d1cefe31674a45d0c Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Mon, 4 Nov 2024 17:06:52 -0600 Subject: [PATCH 8/8] bugfix test update for CMS5 --- phpcs.xml.dist | 34 ++++++++++++---------------------- src/ORM/FlexSlider.php | 2 +- tests/FlexSliderTest.php | 2 +- tests/SlideImageTest.php | 2 +- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1f36b0e..86b1ca4 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,24 +1,14 @@ - - - Coding standard for SilverStripe 4.x - - - */vendor/* - */thirdparty/* - - - - - - - - - - - - - - - + + + CodeSniffer ruleset for SilverStripe coding conventions. + + src + tests + + + + + + diff --git a/src/ORM/FlexSlider.php b/src/ORM/FlexSlider.php index ebc2213..d338c46 100644 --- a/src/ORM/FlexSlider.php +++ b/src/ORM/FlexSlider.php @@ -123,7 +123,7 @@ public function updateCMSFields(FieldList $fields) $config ); - $slideTitle = $this->owner->stat('slide_tab_title') ?: _t(__CLASS__ . '.SLIDES', 'Slides'); + $slideTitle = $this->owner->config()->get('slide_tab_title') ?: _t(__CLASS__ . '.SLIDES', 'Slides'); $animations = []; $animationOptions = $this->owner->dbObject('Animation')->getEnum(); diff --git a/tests/FlexSliderTest.php b/tests/FlexSliderTest.php index af4e59b..8c14986 100644 --- a/tests/FlexSliderTest.php +++ b/tests/FlexSliderTest.php @@ -44,7 +44,7 @@ public function testTabNameConfig() $this->assertNotNull($pageFields->dataFieldByName('Slides')); Config::modify() - ->update(TestPage::class, 'slide_tab_title', 'MyCustomSlideTitle'); + ->set(TestPage::class, 'slide_tab_title', 'MyCustomSlideTitle'); $page2 = TestPage::create(); $page2->write(); $page2Fields = $page2->getCMSFields(); diff --git a/tests/SlideImageTest.php b/tests/SlideImageTest.php index eba7b56..e6e57a7 100644 --- a/tests/SlideImageTest.php +++ b/tests/SlideImageTest.php @@ -188,7 +188,7 @@ public function testImageSizeLimit() $this->assertEquals(Config::modify()->get(SlideImage::class, 'image_size_limit'), $default); $new = 1024000; - Config::modify()->update(SlideImage::class, 'image_size_limit', $new); + Config::modify()->set(SlideImage::class, 'image_size_limit', $new); $this->assertEquals(Config::modify()->get(SlideImage::class, 'image_size_limit'), $new); }