Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5ab2c59
mod: bump SS framework & CMS to v6
cotpat Oct 1, 2025
846c0d6
mod: bump versioned to v3, as SS 6 depends on it
cotpat Oct 1, 2025
76b4776
mod: bump phpunit so it and SS agree on a sebastian/diff version
cotpat Oct 1, 2025
944b662
mod: fix PHP version to 8.4 versions
cotpat Oct 2, 2025
c9821e2
fix: do not do major phpunit updates!
cotpat Oct 2, 2025
b6168cc
mod: loosen PHP requirement
cotpat Oct 6, 2025
6cc22fc
mod: new jobs for workflow
cotpat Oct 6, 2025
40b5089
mod: apply jobs to 6 branch
cotpat Oct 6, 2025
c2d883e
fix: path typo
cotpat Oct 6, 2025
66b2cf3
mod: apply jobs to 6 branch
cotpat Oct 6, 2025
7cf3dd9
fix: tighten PHP version (min. 8.3)
cotpat Oct 6, 2025
70369d8
add: additional PHPstan & code coverage config
cotpat Oct 6, 2025
4352540
mod: test newer PHPunit version
cotpat Oct 6, 2025
26a4128
mod: revert version test
cotpat Oct 6, 2025
71db83d
fix: reflect SS6 class name change
cotpat Oct 6, 2025
b7d06c2
test: test new PHPstan major version
cotpat Oct 6, 2025
535f9a3
test: revert testing
cotpat Oct 6, 2025
4c026ed
test: ultimate constraint loosening
cotpat Oct 6, 2025
b50f5e5
test: another constraint loosening
cotpat Oct 6, 2025
8884706
fix: wrong phpstan dep
cotpat Oct 6, 2025
5fdbac8
fix: remove testing for 5 and master branch
cotpat Oct 6, 2025
480e8a9
fix: typo
cotpat Oct 7, 2025
0ef09aa
fix: statify testFileAsserts
cotpat Oct 7, 2025
cb9b3e4
mod: shotgun static!
cotpat Oct 7, 2025
edf0c07
mod: shotgun static!
cotpat Oct 7, 2025
b679ffa
mod: shotgun static!
cotpat Oct 7, 2025
6600561
Revert "fix: statify testFileAsserts"
cotpat Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ on:
- .htaccess
- '**.md'
branches:
- master
- '5'
- '6'
pull_request:
paths-ignore:
- .chglog/**
Expand All @@ -24,29 +23,27 @@ on:
- .htaccess
- '**.md'
branches:
- master
- '5'
- '6'

jobs:
silverstripe-module:
name: 🧰 Silverstripe Module Testsuite
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module.yml@5
silverstripe-module-6:
name: 🧰 Silverstripe Module Testsuite 6
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-6.yml@master
with:
phpunit: true
phpunit_config_file: tests/phpunit.xml
phpstan: true
phpstan_config: tests/phpstan.neon
phpstan_bootstrap: tests/bootstrap-phpstan.php
phpcs: true
# silverstripe-client:
# name: 📦 Client Testsuite
# uses: syntro-opensource/workflows/.github/workflows/client.yml@master
# with:
# eslint: true
# eslint_dir: client/src/seo-field/
# eslint_configfile: client/src/seo-field/.eslintrc
# eslint_ext:
# eslint_max-warnings:
# stylelint: true
# stylelint_glob: client/src/seo-field/**/*.scss
# stylelint_max-warnings:
silverstripe-module-codecoverage:
name: 📊 Silverstripe Code Coverage
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-codecoverage.yml@master
with:
php_version: 8.3
silverstripe_version: 6.0
phpunit_config_file: tests/phpunit.xml
silverstripe-phpcs:
name: 🧹 Silverstripe PHPCS
uses: syntro-opensource/workflows/.github/workflows/silverstripe-phpcs.yml@master
with:
dir: src/
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
}
],
"require": {
"php": "~8.0",
"silverstripe/framework": "~5.0",
"phpstan/phpstan": "^1.5",
"silverstripe/versioned": "^2.0"
"php": "~8.3",
"silverstripe/framework": "~6.0",
"phpstan/phpstan": "^2.0",
"silverstripe/versioned": "^3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.0",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^9.4",
"silverstripe/cms": "^5.0"
"phpstan/phpstan-phpunit": "*",
"phpunit/phpunit": "^11.0",
"silverstripe/cms": "^6.0"
},
"scripts": {
"phpcs": "phpcs -n -l src/ src/Reflection/ src/Rule/ src/Type tests/ tests/Reflection/ tests/Rule/ tests/Type/",
Expand Down
2 changes: 1 addition & 1 deletion src/ClassHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ClassHelper
{
// const SSObject = 'Object'; // Removed in SS 4.X
const ViewableData = \SilverStripe\View\ViewableData::class;
const ModelData = \SilverStripe\Model\ModelData::class;
const DataObject = \SilverStripe\ORM\DataObject::class;
const Extensible = \SilverStripe\Core\Extensible::class;

Expand Down
6 changes: 3 additions & 3 deletions tests/Reflection/MethodClassReflectionExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
use PHPStan\Testing\TypeInferenceTestCase;
use SilverStripe\Core\Config\Config;

class MethodClassReflectionExtensionTest extends TypeInferenceTestCase
class MethodClassReflectionExtensionTest extends TypeInferenceTestCase
{
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
// path to a file with actual asserts of expected types:
require_once(__DIR__ . '/data/method-class-reflection.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/method-class-reflection.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/method-class-reflection.php');
}

/**
Expand Down
24 changes: 12 additions & 12 deletions tests/Reflection/SiteTreeMethodClassReflectionExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
final class SiteTreeMethodClassReflectionExtensionTest extends \PHPStan\Testing\PHPStanTestCase
{
/** @var \PHPStan\Broker\Broker */
private $broker;
private static $broker;

/** @var MethodClassReflectionExtension */
private $method;
private static $method;

protected function setUp(): void
{
$this->broker = $this->createBroker();
$this->method = new MethodClassReflectionExtension();
$this->method->setBroker($this->broker);
self::$broker = $this->createReflectionProvider();
self::$method = new MethodClassReflectionExtension();
self::$method->setBroker($this->broker);
}

public function dataHasMethod(): array
public static function dataHasMethod(): array
{
return [
[
Expand All @@ -54,10 +54,10 @@ public function dataHasMethod(): array
* @param string $method
* @param bool $result
*/
public function testHasMethod(string $className, string $method, bool $result): void
public static function testHasMethod(string $className, string $method, bool $result): void
{
$classReflection = $this->broker->getClass($className);
self::assertSame($result, $this->method->hasMethod($classReflection, $method));
$classReflection = self::$broker->getClass($className);
self::assertSame($result, self::$method->hasMethod($classReflection, $method));
}

public function testParentMethod(): void
Expand All @@ -74,10 +74,10 @@ public function testParentMethod(): void
self::assertSame(ClassHelper::SiteTree, $resultType->getClassName());
}

public function testLinkTrackingMethod(): void
public static function testLinkTrackingMethod(): void
{
$classReflection = $this->broker->getClass(ClassHelper::SiteTree);
$methodReflection = $this->method->getMethod($classReflection, 'LinkTracking');
$classReflection = self::$broker->getClass(ClassHelper::SiteTree);
$methodReflection = self::$method->getMethod($classReflection, 'LinkTracking');
self::assertSame('LinkTracking', $methodReflection->getName());
$dataListType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
self::assertSame(DataListType::class, get_class($dataListType));
Expand Down
Loading