diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f28917a..b4e446e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,8 +11,7 @@ on: - .htaccess - '**.md' branches: - - master - - '5' + - '6' pull_request: paths-ignore: - .chglog/** @@ -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/ diff --git a/composer.json b/composer.json index 8c2f727..a672f18 100644 --- a/composer.json +++ b/composer.json @@ -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/", diff --git a/src/ClassHelper.php b/src/ClassHelper.php index beafad9..3349b58 100644 --- a/src/ClassHelper.php +++ b/src/ClassHelper.php @@ -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; diff --git a/tests/Reflection/MethodClassReflectionExtensionTest.php b/tests/Reflection/MethodClassReflectionExtensionTest.php index 8fd7c97..c9343a8 100644 --- a/tests/Reflection/MethodClassReflectionExtensionTest.php +++ b/tests/Reflection/MethodClassReflectionExtensionTest.php @@ -6,16 +6,16 @@ use PHPStan\Testing\TypeInferenceTestCase; use SilverStripe\Core\Config\Config; -class MethodClassReflectionExtensionTest extends TypeInferenceTestCase +class MethodClassReflectionExtensionTest extends TypeInferenceTestCase { /** * @return iterable */ - 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'); } /** diff --git a/tests/Reflection/SiteTreeMethodClassReflectionExtensionTest.php b/tests/Reflection/SiteTreeMethodClassReflectionExtensionTest.php index 2694c01..817b435 100644 --- a/tests/Reflection/SiteTreeMethodClassReflectionExtensionTest.php +++ b/tests/Reflection/SiteTreeMethodClassReflectionExtensionTest.php @@ -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 [ [ @@ -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 @@ -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));