MNT: Move from Travis to Github Actions. Update min dependencies

This commit is contained in:
Chris Penny 2023-03-01 10:08:57 +13:00
parent 4dd62ae986
commit ef5eeee3c9
8 changed files with 31 additions and 48 deletions

12
.github/workflows/main.yml vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea/

View File

@ -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

View File

@ -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": {

View File

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/php</directory>
</testsuite>
<testsuites>
<testsuite name="Default">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/php</directory>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>

View File

@ -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
{

View File

@ -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';

View File

@ -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
}