Compare commits

..

6 Commits

Author SHA1 Message Date
UndefinedOffset
402dab8faa
Updated calls to set-output in the github actions workflow 2023-05-08 10:51:31 -03:00
UndefinedOffset
bb65d01748
Removed PHPCS test's plugin enabling 2023-05-08 10:40:38 -03:00
UndefinedOffset
e3d92e774a
Changed mysql engine for tests 2023-05-08 10:38:12 -03:00
UndefinedOffset
237716571f
Added missing allow plugins for composer 2023-05-08 10:36:11 -03:00
UndefinedOffset
3940a7475f
Updated changelog and license 2023-05-08 10:32:33 -03:00
UndefinedOffset
29957be873
Enabled Silverstripe 5 testing
Adjusted composer requirements to allow Silverstripe 5

Replaced some deprecated api calls
2023-05-08 10:27:50 -03:00
9 changed files with 42 additions and 35 deletions

View File

@ -15,12 +15,12 @@ on:
jobs: jobs:
silverstripe_411_php74: silverstripe_5_php81:
name: "Silverstripe 4.11 | PHP 7.4" name: "Silverstripe 5.0 | PHP 8.1"
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')" if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
env: env:
php_version: 7.4 php_version: 8.1
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
services: services:
mysql: mysql:
@ -35,7 +35,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup PHP Extension Cache - name: Setup PHP Extension Cache
id: cache-env id: cache-env
@ -46,7 +46,7 @@ jobs:
key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }} key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Cache PHP Extensions - name: Cache PHP Extensions
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.cache-env.outputs.dir }} path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }} key: ${{ steps.cache-env.outputs.key }}
@ -59,18 +59,18 @@ jobs:
extensions: ${{ env.php_extensions }} extensions: ${{ env.php_extensions }}
ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log" ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log"
coverage: none coverage: none
tools: composer:v1 tools: composer:v2
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)" run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies - name: Cache composer dependencies
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-ss411-php74-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }} key: ${{ runner.os }}-composer-ss5-php81-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: ${{ runner.os }}-composer-ss411-php74- restore-keys: ${{ runner.os }}-composer-ss5-php81-
- name: Install Composer dependencies - name: Install Composer dependencies
env: env:
@ -78,8 +78,11 @@ jobs:
run: | run: |
composer self-update --ansi || true composer self-update --ansi || true
if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi
composer require silverstripe/admin 1.11.* --no-update composer config allow-plugins.composer/installers true
composer require silverstripe/versioned 1.11.* composer config allow-plugins.silverstripe/recipe-plugin true
composer config allow-plugins.silverstripe/vendor-plugin true
composer require silverstripe/admin 2.0.* --no-update
composer require silverstripe/versioned 2.0.*
composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi
- name: Configure Environment - name: Configure Environment
@ -112,7 +115,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup PHP Extension Cache - name: Setup PHP Extension Cache
id: cache-env id: cache-env
@ -123,7 +126,7 @@ jobs:
key: php80-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }} key: php80-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Cache PHP Extensions - name: Cache PHP Extensions
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.cache-env.outputs.dir }} path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }} key: ${{ steps.cache-env.outputs.key }}
@ -140,10 +143,10 @@ jobs:
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)" run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies - name: Cache composer dependencies
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-ss411-php80-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }} key: ${{ runner.os }}-composer-ss411-php80-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }}
@ -177,12 +180,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')" if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
env: env:
php_version: 7.4 php_version: 8.0
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup PHP Extension Cache - name: Setup PHP Extension Cache
id: cache-env id: cache-env
@ -193,7 +196,7 @@ jobs:
key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }} key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Cache PHP Extensions - name: Cache PHP Extensions
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.cache-env.outputs.dir }} path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }} key: ${{ steps.cache-env.outputs.key }}
@ -210,10 +213,10 @@ jobs:
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)" run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies - name: Cache composer dependencies
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('.github/workflows/ci.yml') }} key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('.github/workflows/ci.yml') }}

View File

@ -1,5 +1,8 @@
# Change Log # Change Log
## [2.2.0](https://github.com/UndefinedOffset/SortableGridField/tree/2.2.0) (2023-05-08)
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.1.0...2.2.0)
## [2.1.0](https://github.com/UndefinedOffset/SortableGridField/tree/2.1.0) (2022-07-06) ## [2.1.0](https://github.com/UndefinedOffset/SortableGridField/tree/2.1.0) (2022-07-06)
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.9...2.1.0) [Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.9...2.1.0)

View File

@ -1,4 +1,4 @@
Copyright (c) 2022, Ed Chipman Copyright (c) 2023, Ed Chipman
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,

View File

@ -12,9 +12,8 @@
} }
], ],
"require": { "require": {
"silverstripe/framework": "~4.11", "silverstripe/framework": "~4.11 | ^5",
"silverstripe/versioned": "^1.0", "silverstripe/versioned": "^1 | ^2"
"silverstripe/vendor-plugin": "^1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",

View File

@ -223,7 +223,7 @@ class GridFieldSortableRows extends AbstractGridFieldComponent implements GridFi
$list = clone $dataList; $list = clone $dataList;
$list = $list->alterDataQuery(function ($query, SS_List $tmplist) { $list = $list->alterDataQuery(function ($query, SS_List $tmplist) {
/** @var \SilverStripe\ORM\DataQuery $query */ /** @var \SilverStripe\ORM\DataQuery $query */
$query->limit([]); $query->limit(null);
return $query; return $query;
}); });

View File

@ -111,7 +111,7 @@ class AutoSortTest extends SapphireTest
//Publish all records //Publish all records
foreach ($list as $item) { foreach ($list as $item) {
$item->publish('Stage', 'Live'); $item->publishSingle();
} }
@ -168,7 +168,7 @@ class AutoSortTest extends SapphireTest
//Publish all records //Publish all records
foreach ($list as $item) { foreach ($list as $item) {
$item->publish('Stage', 'Live'); $item->publishSingle();
} }

View File

@ -1,6 +1,7 @@
<?php <?php
namespace UndefinedOffset\SortableGridField\Tests; namespace UndefinedOffset\SortableGridField\Tests;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
@ -9,7 +10,8 @@ use SilverStripe\Forms\Form;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridFieldConfig;
use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationException;
use SilverStripe\Security\Member; use SilverStripe\Security\IdentityStore;
use SilverStripe\Security\Security;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
use UndefinedOffset\SortableGridField\Tests\Forms\AutoSortTest\DummyController; use UndefinedOffset\SortableGridField\Tests\Forms\AutoSortTest\DummyController;
@ -48,8 +50,8 @@ class OrderingTest extends SapphireTest
public function testSortActionWithoutCorrectPermission() public function testSortActionWithoutCorrectPermission()
{ {
if (Member::currentUser()) { if (Security::getCurrentUser()) {
Member::currentUser()->logOut(); Injector::inst()->get(IdentityStore::class)->logOut(Controller::curr()->getRequest());
} }
$this->expectException(ValidationException::class); $this->expectException(ValidationException::class);
@ -97,7 +99,7 @@ class OrderingTest extends SapphireTest
//Publish all records //Publish all records
foreach ($list as $item) { foreach ($list as $item) {
$item->publish('Stage', 'Live'); $item->publishSingle();
} }
$team1 = $this->objFromFixture(VTeam::class, 'team1'); $team1 = $this->objFromFixture(VTeam::class, 'team1');

View File

@ -107,7 +107,7 @@ class PageSortingTest extends SapphireTest
//Publish all records //Publish all records
foreach ($list as $item) { foreach ($list as $item) {
$item->publish('Stage', 'Live'); $item->publishSingle();
} }
@ -154,7 +154,7 @@ class PageSortingTest extends SapphireTest
//Publish all records //Publish all records
foreach ($list as $item) { foreach ($list as $item) {
$item->publish('Stage', 'Live'); $item->publishSingle();
} }

View File

@ -1,7 +1,7 @@
SS_ENVIRONMENT_TYPE="dev" SS_ENVIRONMENT_TYPE="dev"
SS_TRUSTED_PROXY_IPS="*" SS_TRUSTED_PROXY_IPS="*"
SS_DATABASE_CLASS="MySQLPDODatabase" SS_DATABASE_CLASS="MySQLDatabase"
SS_DATABASE_SERVER="127.0.0.1" SS_DATABASE_SERVER="127.0.0.1"
SS_DATABASE_USERNAME="root" SS_DATABASE_USERNAME="root"
SS_DATABASE_PASSWORD="testpassword" SS_DATABASE_PASSWORD="testpassword"