diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f5cf08c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + # Every Monday at 2:30pm UTC + schedule: + - cron: '30 14 * * 1' + +jobs: + ci: + name: CI + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml new file mode 100644 index 0000000..ebf9716 --- /dev/null +++ b/.github/workflows/keepalive.yml @@ -0,0 +1,17 @@ +name: Keepalive + +on: + workflow_dispatch: + # The 4th of every month at 10:50am UTC + schedule: + - cron: '50 10 4 * *' + +jobs: + keepalive: + name: Keepalive + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + runs-on: ubuntu-latest + steps: + - name: Keepalive + uses: silverstripe/gha-keepalive@v1 diff --git a/README.md b/README.md index d8d9cb9..0534f7e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Browser Test Session Module -[![Build Status](https://travis-ci.org/silverstripe-labs/silverstripe-testsession.svg)](https://travis-ci.org/silverstripe-labs/silverstripe-testsession) +[![CI](https://github.com/silverstripe/silverstripe-testsession/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-testsession/actions/workflows/ci.yml) ## Overview @@ -47,7 +47,7 @@ and interact with it through other URL endpoints. Commands: * `dev/testsession`: Shows options for starting a test session - * `dev/testsession/start`: Sets up test state, most commonly a test database will be constructed, + * `dev/testsession/start`: Sets up test state, most commonly a test database will be constructed, and your browser session will be amended to use this database. See "Parameters" documentation below. * `dev/testsession/end`: Removes the test state, and resets to the original database. * `dev/testsession/loadfixture?fixture=`: Loads a fixture into an existing test state. @@ -59,15 +59,15 @@ While you can use the interface to set the test session state, it can be useful to set them programmatically through query parameters on "dev/testsession/start": - * `fixture`: Loads a YAML fixture in the format generally accepted by `SapphireTest` - (see [fixture format docs](http://doc.silverstripe.org/en/developer_guides/testing/fixtures/)). + * `fixture`: Loads a YAML fixture in the format generally accepted by `SapphireTest` + (see [fixture format docs](http://doc.silverstripe.org/en/developer_guides/testing/fixtures/)). The path should be relative to the webroot. * `createDatabase`: Create a temporary database. * `importDatabasePath`: Absolute path to a database dump to load into a newly created temporary database. * `importDatabaseFilename`: File name for a database dump to load, relative to `TestSessionController.database_templates_path` * `requireDefaultRecords`: Include default records as defined on the model classes (in PHP) - * `database`: Set an alternative database name in the current - browser session as a cookie. Does not actually create the database, + * `database`: Set an alternative database name in the current + browser session as a cookie. Does not actually create the database, that's usually handled by `SapphireTest::create_temp_db()`. Note: The database names are limited to a specific naming convention as a security measure: The "ss_tmpdb" prefix and a random sequence of seven digits. @@ -76,9 +76,9 @@ on "dev/testsession/start": * `datetime`: Sets a simulated date used for all framework operations. Format as "yyyy-MM-dd HH:mm:ss" (Example: "2012-12-31 18:40:59"). * `globalTestSession`: Activate test session independently of the current browser session, - effectively setting the site into test session mode for all users across different browsers. - Only available in "dev" mode. For example, create a global test session in Chrome, then you can share - the session data in Firefox. But if you have started a non-global session in a browser before starting + effectively setting the site into test session mode for all users across different browsers. + Only available in "dev" mode. For example, create a global test session in Chrome, then you can share + the session data in Firefox. But if you have started a non-global session in a browser before starting a global session somewhere else, that non-global session will take priority in that browser. Example usage with parameters: diff --git a/composer.json b/composer.json index 005e695..aa9338b 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ "silverstripe/framework": "^4@dev", "silverstripe/vendor-plugin": "^1.3" }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.5" + }, "extra": { - "branch-alias": { - "2.x-dev": "2.2.x-dev" - }, "expose": [ "client" ] diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 5a8fb14..38c63ed 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,6 +2,8 @@ CodeSniffer ruleset for SilverStripe coding conventions. + src +