Remove phpspec entirely

This commit is contained in:
Grzegorz Sadowski 2025-05-29 14:23:25 +02:00
parent 454776856c
commit 1fe314c30d
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
18 changed files with 3 additions and 186 deletions

View file

@ -69,10 +69,6 @@ indent_size = 4
indent_style = space
indent_size = 2
[phpspec.yml{,.dist}]
indent_style = space
indent_size = 4
[phpstan.neon]
indent_style = space
indent_size = 4

1
.gitattributes vendored
View file

@ -30,7 +30,6 @@ Makefile export-ignore
monorepo-builder.php export-ignore
/package.json export-ignore
phparkitect.php export-ignore
phpspec.yml.dist export-ignore
phpstan.neon.dist export-ignore
phpstan-baseline.neon export-ignore
phpunit.xml.dist export-ignore

1
.gitignore vendored
View file

@ -2,7 +2,6 @@
/behat.yml
/composer.lock
/docker-compose.override.yml
/phpspec.yml
/public/media
!/public/media/image/.gitkeep
###< project files ###

View file

@ -1,9 +1,6 @@
phpunit:
vendor/bin/phpunit
phpspec:
vendor/bin/phpspec run --ansi --no-interaction -f dot
phpstan:
vendor/bin/phpstan analyse
@ -32,11 +29,11 @@ behat: behat-cli behat-non-js behat-js
init: install backend frontend
ci: init phpstan phpunit phpspec behat
ci: init phpstan phpunit behat
integration: init phpunit behat-cli behat-non-js
static: install phpspec phpstan
static: install phpstan
# Example execution: make profile url=http://app
profile:

View file

@ -9,7 +9,7 @@ Sylius is an Open Source eCommerce framework on top of [**Symfony**](https://sym
The highest quality of code, strong testing culture, built-in Agile (BDD) workflow and exceptional flexibility make it the best solution for applications tailored to your business requirements.
Powerful REST API allows for easy integrations and creating unique customer experience on any device.
We're using full-stack Behavior-Driven-Development, with [phpspec](https://phpspec.net) and [Behat](https://behat.org).
We're using full-stack Behavior-Driven-Development, with [PHPUnit](https://phpunit.de) and [Behat](https://behat.org).
Enjoy being an eCommerce Developer again!

View file

@ -80,10 +80,6 @@ class RoboFile extends Tasks
$task->exec('Tests/Application/bin/console doctrine:schema:update --force');
}
if (file_exists(sprintf('%s/phpspec.yml', $packagePath)) || file_exists(sprintf('%s/phpspec.yml.dist', $packagePath)) || file_exists(sprintf('%s/phpspec.yaml', $packagePath))) {
$task->exec('vendor/bin/phpspec run --ansi --no-interaction -f dot');
}
if (file_exists(sprintf('%s/phpunit.xml', $packagePath)) || file_exists(sprintf('%s/phpunit.xml.dist', $packagePath))) {
$task->exec('vendor/bin/phpunit --colors=always');
}

View file

@ -213,7 +213,6 @@
"mockery/mockery": "^1.6",
"nyholm/psr7": "^1.8",
"phparkitect/phparkitect": "^0.6",
"phpspec/phpspec": "^7.5",
"phpspec/prophecy-phpunit": "^2.2",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.0",
@ -222,7 +221,6 @@
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^10.5",
"psr/event-dispatcher": "^1.0",
"rector/custom-phpspec-to-phpunit": "^0.6",
"rector/rector": "^2.0",
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.4",
@ -275,8 +273,6 @@
"exclude-from-classmap": [
"src/Sylius/*/*/Tests/",
"src/Sylius/Component/Core/Test/Tests/",
"src/Sylius/*/*/spec/",
"src/Sylius/*/*/disabledSpec/",
"src/Sylius/*/*/test/",
"src/Sylius/*/*/phparkitect.php"
]
@ -285,45 +281,6 @@
"psr-4": {
"Sylius\\Tests\\": "tests/",
"Tests\\Sylius\\Behat\\": "src/Sylius/Behat/tests/",
"spec\\Sylius\\Component\\Addressing\\": "src/Sylius/Component/Addressing/spec/",
"spec\\Sylius\\Component\\Attribute\\": "src/Sylius/Component/Attribute/spec/",
"spec\\Sylius\\Component\\Channel\\": "src/Sylius/Component/Channel/spec/",
"spec\\Sylius\\Component\\Core\\": "src/Sylius/Component/Core/spec/",
"spec\\Sylius\\Component\\Currency\\": "src/Sylius/Component/Currency/spec/",
"spec\\Sylius\\Component\\Customer\\": "src/Sylius/Component/Customer/spec/",
"spec\\Sylius\\Component\\Inventory\\": "src/Sylius/Component/Inventory/spec/",
"spec\\Sylius\\Component\\Locale\\": "src/Sylius/Component/Locale/spec/",
"spec\\Sylius\\Component\\Order\\": "src/Sylius/Component/Order/spec/",
"spec\\Sylius\\Component\\Payment\\": "src/Sylius/Component/Payment/spec/",
"spec\\Sylius\\Component\\Product\\": "src/Sylius/Component/Product/spec/",
"spec\\Sylius\\Component\\Promotion\\": "src/Sylius/Component/Promotion/spec/",
"spec\\Sylius\\Component\\Review\\": "src/Sylius/Component/Review/spec/",
"spec\\Sylius\\Component\\Shipping\\": "src/Sylius/Component/Shipping/spec/",
"spec\\Sylius\\Component\\Taxation\\": "src/Sylius/Component/Taxation/spec/",
"spec\\Sylius\\Component\\Taxonomy\\": "src/Sylius/Component/Taxonomy/spec/",
"spec\\Sylius\\Component\\User\\": "src/Sylius/Component/User/spec/",
"spec\\Sylius\\Bundle\\AddressingBundle\\": "src/Sylius/Bundle/AddressingBundle/spec/",
"spec\\Sylius\\Bundle\\AdminBundle\\": "src/Sylius/Bundle/AdminBundle/spec/",
"spec\\Sylius\\Bundle\\ApiBundle\\": "src/Sylius/Bundle/ApiBundle/spec/",
"spec\\Sylius\\Bundle\\AttributeBundle\\": "src/Sylius/Bundle/AttributeBundle/spec/",
"spec\\Sylius\\Bundle\\ChannelBundle\\": "src/Sylius/Bundle/ChannelBundle/spec/",
"spec\\Sylius\\Bundle\\CoreBundle\\": "src/Sylius/Bundle/CoreBundle/spec/",
"spec\\Sylius\\Bundle\\CurrencyBundle\\": "src/Sylius/Bundle/CurrencyBundle/spec/",
"spec\\Sylius\\Bundle\\CustomerBundle\\": "src/Sylius/Bundle/CustomerBundle/spec/",
"spec\\Sylius\\Bundle\\InventoryBundle\\": "src/Sylius/Bundle/InventoryBundle/spec/",
"spec\\Sylius\\Bundle\\LocaleBundle\\": "src/Sylius/Bundle/LocaleBundle/spec/",
"spec\\Sylius\\Bundle\\MoneyBundle\\": "src/Sylius/Bundle/MoneyBundle/spec/",
"spec\\Sylius\\Bundle\\OrderBundle\\": "src/Sylius/Bundle/OrderBundle/spec/",
"spec\\Sylius\\Bundle\\PaymentBundle\\": "src/Sylius/Bundle/PaymentBundle/spec/",
"spec\\Sylius\\Bundle\\PayumBundle\\": "src/Sylius/Bundle/PayumBundle/spec/",
"spec\\Sylius\\Bundle\\ProductBundle\\": "src/Sylius/Bundle/ProductBundle/spec/",
"spec\\Sylius\\Bundle\\PromotionBundle\\": "src/Sylius/Bundle/PromotionBundle/spec/",
"spec\\Sylius\\Bundle\\ReviewBundle\\": "src/Sylius/Bundle/ReviewBundle/spec/",
"spec\\Sylius\\Bundle\\ShopBundle\\": "src/Sylius/Bundle/ShopBundle/spec/",
"spec\\Sylius\\Bundle\\TaxationBundle\\": "src/Sylius/Bundle/TaxationBundle/spec/",
"spec\\Sylius\\Bundle\\TaxonomyBundle\\": "src/Sylius/Bundle/TaxonomyBundle/spec/",
"spec\\Sylius\\Bundle\\UiBundle\\": "src/Sylius/Bundle/UiBundle/spec/",
"spec\\Sylius\\Bundle\\UserBundle\\": "src/Sylius/Bundle/UserBundle/spec/",
"Tests\\Sylius\\Abstraction\\StateMachine\\": "src/Sylius/Abstraction/StateMachine/tests"
},
"classmap": [

View file

@ -4,34 +4,14 @@ declare(strict_types=1);
use Arkitect\ClassSet;
use Arkitect\CLI\Config;
use Arkitect\Expression\ForClasses\Extend;
use Arkitect\Expression\ForClasses\HaveNameMatching;
use Arkitect\Expression\ForClasses\IsFinal;
use Arkitect\Expression\ForClasses\IsNotAbstract;
use Arkitect\Expression\ForClasses\NotDependsOnTheseNamespaces;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\Rule;
use PhpSpec\ObjectBehavior;
return static function (Config $config): void
{
$specClassSet = ClassSet::fromDir(__DIR__ . '/src/Sylius/{Behat,Component/*,Bundle/*}/spec');
$config->add(
$specClassSet,
Rule::allClasses()
->that(new Extend(ObjectBehavior::class))
->should(new HaveNameMatching('*Spec'))
->because('Specifications should follow PHPSpec naming convention')
,
Rule::allClasses()
->that(new Extend(ObjectBehavior::class))
->andThat(new IsNotAbstract())
->should(new IsFinal())
->because('Specifications should not be extendable')
,
);
$testsClassSet = ClassSet::fromDir(__DIR__ . '{/tests,/src/Sylius/Bundle/*/Tests}');
$config->add(

View file

@ -1,42 +0,0 @@
suites:
Addressing: { namespace: Sylius\Component\Addressing, psr4_prefix: Sylius\Component\Addressing, spec_path: src/Sylius/Component/Addressing, src_path: src/Sylius/Component/Addressing }
Attribute: { namespace: Sylius\Component\Attribute, psr4_prefix: Sylius\Component\Attribute, spec_path: src/Sylius/Component/Attribute, src_path: src/Sylius/Component/Attribute }
Channel: { namespace: Sylius\Component\Channel, psr4_prefix: Sylius\Component\Channel, spec_path: src/Sylius/Component/Channel, src_path: src/Sylius/Component/Channel }
Core: { namespace: Sylius\Component\Core, psr4_prefix: Sylius\Component\Core, spec_path: src/Sylius/Component/Core, src_path: src/Sylius/Component/Core }
Currency: { namespace: Sylius\Component\Currency, psr4_prefix: Sylius\Component\Currency, spec_path: src/Sylius/Component/Currency, src_path: src/Sylius/Component/Currency }
Customer: { namespace: Sylius\Component\Customer, psr4_prefix: Sylius\Component\Customer, spec_path: src/Sylius/Component/Customer, src_path: src/Sylius/Component/Customer }
Inventory: { namespace: Sylius\Component\Inventory, psr4_prefix: Sylius\Component\Inventory, spec_path: src/Sylius/Component/Inventory, src_path: src/Sylius/Component/Inventory }
Locale: { namespace: Sylius\Component\Locale, psr4_prefix: Sylius\Component\Locale, spec_path: src/Sylius/Component/Locale, src_path: src/Sylius/Component/Locale }
Order: { namespace: Sylius\Component\Order, psr4_prefix: Sylius\Component\Order, spec_path: src/Sylius/Component/Order, src_path: src/Sylius/Component/Order }
Payment: { namespace: Sylius\Component\Payment, psr4_prefix: Sylius\Component\Payment, spec_path: src/Sylius/Component/Payment, src_path: src/Sylius/Component/Payment }
Product: { namespace: Sylius\Component\Product, psr4_prefix: Sylius\Component\Product, spec_path: src/Sylius/Component/Product, src_path: src/Sylius/Component/Product }
Promotion: { namespace: Sylius\Component\Promotion, psr4_prefix: Sylius\Component\Promotion, spec_path: src/Sylius/Component/Promotion, src_path: src/Sylius/Component/Promotion }
Review: { namespace: Sylius\Component\Review, psr4_prefix: Sylius\Component\Review, spec_path: src/Sylius/Component/Review, src_path: src/Sylius/Component/Review }
Shipping: { namespace: Sylius\Component\Shipping, psr4_prefix: Sylius\Component\Shipping, spec_path: src/Sylius/Component/Shipping, src_path: src/Sylius/Component/Shipping }
Taxation: { namespace: Sylius\Component\Taxation, psr4_prefix: Sylius\Component\Taxation, spec_path: src/Sylius/Component/Taxation, src_path: src/Sylius/Component/Taxation }
Taxonomy: { namespace: Sylius\Component\Taxonomy, psr4_prefix: Sylius\Component\Taxonomy, spec_path: src/Sylius/Component/Taxonomy, src_path: src/Sylius/Component/Taxonomy }
User: { namespace: Sylius\Component\User, psr4_prefix: Sylius\Component\User, spec_path: src/Sylius/Component/User, src_path: src/Sylius/Component/User }
AddressingBundle: { namespace: Sylius\Bundle\AddressingBundle, psr4_prefix: Sylius\Bundle\AddressingBundle, spec_path: src/Sylius/Bundle/AddressingBundle, src_path: src/Sylius/Bundle/AddressingBundle }
AdminBundle: { namespace: Sylius\Bundle\AdminBundle, psr4_prefix: Sylius\Bundle\AdminBundle, spec_path: src/Sylius/Bundle/AdminBundle, src_path: src/Sylius/Bundle/AdminBundle }
ApiBundle: { namespace: Sylius\Bundle\ApiBundle, psr4_prefix: Sylius\Bundle\ApiBundle, spec_path: src/Sylius/Bundle/ApiBundle, src_path: src/Sylius/Bundle/ApiBundle }
AttributeBundle: { namespace: Sylius\Bundle\AttributeBundle, psr4_prefix: Sylius\Bundle\AttributeBundle, spec_path: src/Sylius/Bundle/AttributeBundle, src_path: src/Sylius/Bundle/AttributeBundle }
ChannelBundle: { namespace: Sylius\Bundle\ChannelBundle, psr4_prefix: Sylius\Bundle\ChannelBundle, spec_path: src/Sylius/Bundle/ChannelBundle, src_path: src/Sylius/Bundle/ChannelBundle }
CoreBundle: { namespace: Sylius\Bundle\CoreBundle, psr4_prefix: Sylius\Bundle\CoreBundle, spec_path: src/Sylius/Bundle/CoreBundle, src_path: src/Sylius/Bundle/CoreBundle }
CurrencyBundle: { namespace: Sylius\Bundle\CurrencyBundle, psr4_prefix: Sylius\Bundle\CurrencyBundle, spec_path: src/Sylius/Bundle/CurrencyBundle, src_path: src/Sylius/Bundle/CurrencyBundle }
CustomerBundle: { namespace: Sylius\Bundle\CustomerBundle, psr4_prefix: Sylius\Bundle\CustomerBundle, spec_path: src/Sylius/Bundle/CustomerBundle, src_path: src/Sylius/Bundle/CustomerBundle }
InventoryBundle: { namespace: Sylius\Bundle\InventoryBundle, psr4_prefix: Sylius\Bundle\InventoryBundle, spec_path: src/Sylius/Bundle/InventoryBundle, src_path: src/Sylius/Bundle/InventoryBundle }
LocaleBundle: { namespace: Sylius\Bundle\LocaleBundle, psr4_prefix: Sylius\Bundle\LocaleBundle, spec_path: src/Sylius/Bundle/LocaleBundle, src_path: src/Sylius/Bundle/LocaleBundle }
MoneyBundle: { namespace: Sylius\Bundle\MoneyBundle, psr4_prefix: Sylius\Bundle\MoneyBundle, spec_path: src/Sylius/Bundle/MoneyBundle, src_path: src/Sylius/Bundle/MoneyBundle }
OrderBundle: { namespace: Sylius\Bundle\OrderBundle, psr4_prefix: Sylius\Bundle\OrderBundle, spec_path: src/Sylius/Bundle/OrderBundle, src_path: src/Sylius/Bundle/OrderBundle }
PaymentBundle: { namespace: Sylius\Bundle\PaymentBundle, psr4_prefix: Sylius\Bundle\PaymentBundle, spec_path: src/Sylius/Bundle/PaymentBundle, src_path: src/Sylius/Bundle/PaymentBundle }
PayumBundle: { namespace: Sylius\Bundle\PayumBundle, psr4_prefix: Sylius\Bundle\PayumBundle, spec_path: src/Sylius/Bundle/PayumBundle, src_path: src/Sylius/Bundle/PayumBundle }
ProductBundle: { namespace: Sylius\Bundle\ProductBundle, psr4_prefix: Sylius\Bundle\ProductBundle, spec_path: src/Sylius/Bundle/ProductBundle, src_path: src/Sylius/Bundle/ProductBundle }
PromotionBundle: { namespace: Sylius\Bundle\PromotionBundle, psr4_prefix: Sylius\Bundle\PromotionBundle, spec_path: src/Sylius/Bundle/PromotionBundle, src_path: src/Sylius/Bundle/PromotionBundle }
ReviewBundle: { namespace: Sylius\Bundle\ReviewBundle, psr4_prefix: Sylius\Bundle\ReviewBundle, spec_path: src/Sylius/Bundle/ReviewBundle, src_path: src/Sylius/Bundle/ReviewBundle }
ShippingBundle: { namespace: Sylius\Bundle\ShippingBundle, psr4_prefix: Sylius\Bundle\ShippingBundle, spec_path: src/Sylius/Bundle/ShippingBundle, src_path: src/Sylius/Bundle/ShippingBundle }
ShopBundle: { namespace: Sylius\Bundle\ShopBundle, psr4_prefix: Sylius\Bundle\ShopBundle, spec_path: src/Sylius/Bundle/ShopBundle, src_path: src/Sylius/Bundle/ShopBundle }
TaxationBundle: { namespace: Sylius\Bundle\TaxationBundle, psr4_prefix: Sylius\Bundle\TaxationBundle, spec_path: src/Sylius/Bundle/TaxationBundle, src_path: src/Sylius/Bundle/TaxationBundle }
TaxonomyBundle: { namespace: Sylius\Bundle\TaxonomyBundle, psr4_prefix: Sylius\Bundle\TaxonomyBundle, spec_path: src/Sylius/Bundle/TaxonomyBundle, src_path: src/Sylius/Bundle/TaxonomyBundle }
UiBundle: { namespace: Sylius\Bundle\UiBundle, psr4_prefix: Sylius\Bundle\UiBundle, spec_path: src/Sylius/Bundle/UiBundle, src_path: src/Sylius/Bundle/UiBundle }
UserBundle: { namespace: Sylius\Bundle\UserBundle, psr4_prefix: Sylius\Bundle\UserBundle, spec_path: src/Sylius/Bundle/UserBundle, src_path: src/Sylius/Bundle/UserBundle }

View file

@ -1,52 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\PhpSpecToPHPUnit\Set\MigrationSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\Visibility\Rector\ClassMethod\ExplicitPublicClassMethodRector;
return RectorConfig::configure()
->withPaths([
// __DIR__ . '/src/Sylius/Bundle/AddressingBundle/spec',
])
->withImportNames(removeUnusedImports: true)
->withSets([
LevelSetList::UP_TO_PHP_82,
MigrationSetList::PHPSPEC_TO_PHPUNIT,
PHPUnitSetList::PHPUNIT_100,
])
->withRules([
AddParamTypeDeclarationRector::class,
AddReturnTypeDeclarationRector::class,
ExplicitPublicClassMethodRector::class,
])
// After executing:
// vendor/bin/rector process -c rector-spec-unit.php
//
// Some remaining adjustments are required (MacOS sed, other can simply use "sed -i" not "sed -i ''"):
//
// # Fix MockObject phpdoc
// find src/Sylius/path_to_spec_folder/spec/ -type f -name "*Spec.php" -exec sed -i '' "s/\|MockObject /\&MockObject /g" {} +
//
// vendor/bin/phpspec-to-phpunit rename-suffix src/Sylius/path_to_spec_folder/spec/
// vendor/bin/ecs check src/Sylius/path_to_spec_folder/spec/ --fix
// mv src/Sylius/path_to_spec_folder/spec/ src/Sylius/path_to_spec_folder/Tests/
// vendor/bin/phpstan analyse
// vendor/bin/phpunit src/Sylius/path_to_bundle_or_component
//
// Finally, you will have to check for non setup 'setUp' method and add it manually to instantiate the missing context property.
// Ex add this:
//
// private TheCurrentTestedClass $currentClass;
//
// protected function setUp(): void
// {
// $this->currentClass = new TheCurrentTestedClass();
// }
;

View file

@ -1,7 +1,6 @@
/spec export-ignore
/test export-ignore
/Tests export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore

View file

@ -38,7 +38,6 @@
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"nelmio/alice": "^3.13",
"phparkitect/phparkitect": "^0.6",
"phpspec/phpspec": "^7.5",
"phpspec/prophecy-phpunit": "^2.2",
"phpunit/phpunit": "^10.5",
"symfony/browser-kit": "^6.4 || ^7.2",

View file

@ -1,5 +0,0 @@
suites:
main:
namespace: Sylius\Bundle\ApiBundle
psr4_prefix: Sylius\Bundle\ApiBundle
src_path: .

View file

@ -34,7 +34,6 @@
"doctrine/doctrine-bundle": "^2.13",
"doctrine/orm": "^2.18",
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"phpspec/phpspec": "^7.5",
"phpunit/phpunit": "^10.5",
"symfony/browser-kit": "^6.4 || ^7.2",
"symfony/dependency-injection": "^6.4.1 || ^7.2",

View file

@ -44,8 +44,6 @@
"doctrine/doctrine-bundle": "^2.13",
"doctrine/orm": "^2.18",
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"phpspec/phpspec": "^7.5",
"phpspec/prophecy-phpunit": "^2.2",
"phpunit/phpunit": "^10.5",
"symfony/browser-kit": "^6.4 || ^7.2",
"symfony/dependency-injection": "^6.4.1 || ^7.2",

View file

@ -48,7 +48,6 @@
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.13",
"phpspec/prophecy-phpunit": "^2.2",
"phpunit/phpunit": "^10.5",
"symfony/browser-kit": "^6.4 || ^7.2",
"symfony/dependency-injection": "^6.4.1 || ^7.2",

View file

@ -1,6 +1,5 @@
/spec export-ignore
/Tests export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore

View file

@ -87,7 +87,6 @@
"test": [
"@composer validate --strict",
"bin/phpunit --colors=always",
"bin/phpspec run --ansi --no-interaction"
]
},
"minimum-stability": "dev",