From ef5eeee3c9e0d656a904f08a3143f24f7e1ac304 Mon Sep 17 00:00:00 2001 From: Chris Penny Date: Wed, 1 Mar 2023 10:08:57 +1300 Subject: [PATCH] MNT: Move from Travis to Github Actions. Update min dependencies --- .github/workflows/main.yml | 12 +++++++ .gitignore | 1 + .travis.yml | 35 ------------------- composer.json | 6 ++-- phpunit.xml.dist | 12 ++++--- .../BaseElementCMSEditLinkExtension.php | 3 -- src/Model/ElementList.php | 4 +++ tests/php/ElementListTest.php | 6 ++-- 8 files changed, 31 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2e6906d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,12 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + ci: + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 + with: + js: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fe654d2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: php - -env: - global: - - COMPOSER_ROOT_VERSION=1.x-dev - -matrix: - include: - - php: 5.6 - env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 - - php: 7.0 - env: DB=PGSQL PHPUNIT_TEST=1 - - php: 7.0 - env: DB=MYSQL PHPUNIT_TEST=1 - - php: 7.1 - env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 - -before_script: - # Init PHP - - phpenv rehash - - phpenv config-rm xdebug.ini - - # Install composer dependencies - - composer validate - - composer require silverstripe/recipe-cms 1.0.x-dev --no-update - - if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.0.x-dev --no-update; fi - - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile - -script: - - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi - - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi - - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi - -after_success: - - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi diff --git a/composer.json b/composer.json index 545b45e..b5b1328 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,13 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "dnadesign/silverstripe-elemental": ">=3.0", + "php": "^7.4 || ^8", + "silverstripe/cms": "^4.11", + "dnadesign/silverstripe-elemental": "^4", "silverstripe/vendor-plugin": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^5.7", + "silverstripe/recipe-testing": "^2", "squizlabs/php_codesniffer": "^3.0" }, "extra": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 49affdc..2dbbe21 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,15 @@ + - - tests/php - - + + + tests + + src/ - tests/php + tests/ diff --git a/src/Extension/BaseElementCMSEditLinkExtension.php b/src/Extension/BaseElementCMSEditLinkExtension.php index d968592..bbc0454 100644 --- a/src/Extension/BaseElementCMSEditLinkExtension.php +++ b/src/Extension/BaseElementCMSEditLinkExtension.php @@ -9,12 +9,9 @@ use SilverStripe\Control\Controller; use SilverStripe\Core\Extension; /** - * Class BaseElementCMSEditLinkExtension - * * BaseElement can be nested, CMSEditLink() needs to be updated to reflect that * * @property BaseElementCMSEditLinkExtension|$this $owner - * @package DNADesign\ElementalList\Extension */ class BaseElementCMSEditLinkExtension extends Extension { diff --git a/src/Model/ElementList.php b/src/Model/ElementList.php index 7578fa6..25279fe 100644 --- a/src/Model/ElementList.php +++ b/src/Model/ElementList.php @@ -7,6 +7,10 @@ use DNADesign\Elemental\Models\ElementalArea; use DNADesign\Elemental\Extensions\ElementalAreasExtension; use SilverStripe\ORM\FieldType\DBField; +/** + * @property int $ElementsID + * @method ElementalArea Elements() + */ class ElementList extends BaseElement { private static $icon = 'font-icon-block-file-list'; diff --git a/tests/php/ElementListTest.php b/tests/php/ElementListTest.php index 20ee793..901a876 100644 --- a/tests/php/ElementListTest.php +++ b/tests/php/ElementListTest.php @@ -7,19 +7,19 @@ use SilverStripe\Dev\SapphireTest; class ElementListTest extends SapphireTest { - public function testGetRelations() + public function testGetRelations(): void { $list = ElementList::create(); $this->assertEquals(['Elements'], $list->getElementalRelations()); } - public function testGetCmsFields() + public function testGetCmsFields(): void { // todo } - public function testForTemplate() + public function testForTemplate(): void { // todo }