Skip to content

Commit 5f5626f

Browse files
committed
feat: silverstripe6
1 parent c0417b0 commit 5f5626f

File tree

11 files changed

+176
-123
lines changed

11 files changed

+176
-123
lines changed

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# For more information about the properties used in
2+
# this file, please see the EditorConfig documentation:
3+
# http://editorconfig.org/
4+
5+
root = true
6+
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_size = 4
11+
indent_style = space
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[*.{yml,json,tsx,jsx,scss,css,json,js,ts}]
19+
# The indent size used in the `package.json` file cannot be changed
20+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
21+
indent_size = 2
22+
indent_style = space
23+
24+
[composer.json]
25+
indent_size = 4

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
ci:
10+
name: CI
11+
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/public
2+
/vendor
3+
composer.lock
4+
.phpunit.result.cache

composer.json

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,45 @@
1515
}
1616
],
1717
"require": {
18-
"silverstripe/framework": "^4 || ^5",
19-
"level51/silverstripe-jwt-utils": "^1.0"
18+
"silverstripe/framework": "^6",
19+
"level51/silverstripe-jwt-utils": "^0.3.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^9.5",
23-
"squizlabs/php_codesniffer": "^3"
22+
"phpunit/phpunit": "^11",
23+
"squizlabs/php_codesniffer": "^3",
24+
"cambis/silverstan": "^2.1"
2425
},
2526
"extra": {
2627
"branch-alias": {
27-
"dev-main": "1.x-dev"
28+
"dev-main": "2.x-dev"
2829
}
2930
},
31+
"scripts": {
32+
"test": [
33+
"vendor/bin/phpunit"
34+
],
35+
"lint": [
36+
"vendor/bin/phpcs --standard=phpcs.xml.dist src tests"
37+
],
38+
"lint:fix": [
39+
"vendor/bin/phpcbf --standard=phpcs.xml.dist src tests"
40+
],
41+
"stan": [
42+
"vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=2G"
43+
]
44+
},
3045
"autoload": {
3146
"psr-4": {
3247
"FullscreenInteractive\\Restful\\": "src/",
3348
"FullscreenInteractive\\Restful\\Tests\\": "tests/"
3449
}
3550
},
3651
"prefer-stable": true,
37-
"minimum-stability": "dev"
52+
"minimum-stability": "dev",
53+
"config": {
54+
"allow-plugins": {
55+
"composer/installers": true,
56+
"silverstripe/vendor-plugin": true
57+
}
58+
}
3859
}

phpcs.xml.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<file>src</file>
4+
<file>tests</file>
5+
6+
<!-- Show progress and output sniff names on violation, and add colours -->
7+
<arg value="sp"/>
8+
<arg name="colors"/>
9+
10+
<rule ref="PSR12">
11+
<!-- Allow classes to not declare a namespace -->
12+
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
13+
14+
<!-- Allow underscores in class names -->
15+
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
16+
17+
<!-- Allow non camel cased method names -->
18+
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
19+
</rule>
20+
</ruleset>

phpstan.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
includes:
2+
- vendor/cambis/silverstan/extension.neon
3+
parameters:
4+
level: 4
5+
treatPhpDocTypesAsCertain: false
6+
paths:
7+
- src
8+
- tests

phpunit.xml.dist

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
<phpunit bootstrap="../../silverstripe/framework/tests/bootstrap.php" colors="true">
2-
<testsuite name="Default">
3-
<directory>tests</directory>
4-
</testsuite>
5-
6-
<filter>
7-
<whitelist addUncoveredFilesFromWhitelist="true">
8-
<directory suffix=".php">src/</directory>
9-
<exclude>
10-
<directory suffix=".php">tests/</directory>
11-
</exclude>
12-
</whitelist>
13-
</filter>
14-
15-
<php>
16-
<env name="SS_DATABASE_CLASS" value="SQLite3Database" force="true" />
17-
<env name="SS_DATABASE_PATH" value=":memory:" force="true" />
18-
<env name="SS_ENVIRONMENT_TYPE" value="dev" force="true" />
19-
<env name="SS_DATABASE_CHOOSE_NAME" value="true" force="true" />
20-
<env name="SS_DEFAULT_ADMIN_USERNAME" value="admin" force="true" />
21-
<env name="SS_DEFAULT_ADMIN_PASSWORD" value="password" force="true" />
22-
<env name="SS_BASE_URL" value="http://localhost" force="true" />
23-
</php>
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage includeUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
<exclude>
8+
<directory suffix=".php">tests/</directory>
9+
</exclude>
10+
</coverage>
11+
<testsuite name="Default">
12+
<directory>tests</directory>
13+
</testsuite>
2414
</phpunit>

0 commit comments

Comments
 (0)