diff --git a/composer.json b/composer.json index bdf92ca3d..f3d6f8fb0 100755 --- a/composer.json +++ b/composer.json @@ -41,7 +41,6 @@ "require-dev": { "brainmaestro/composer-git-hooks": "^2.3.1", "codacy/coverage": "^1.4", - "codeception/aspect-mock": "^3.0", "php-coveralls/php-coveralls": "^1.0||^2.2", "phpmd/phpmd": "^2.8.0", "phpunit/phpunit": "^9.0", diff --git a/composer.lock b/composer.lock index 226426ef8..232e98fb7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9bec96d8a169a4286803657bbf61004c", + "content-hash": "e68ce0fa4b36ffbd17d27cc6f1f39846", "packages": [ { "name": "allure-framework/allure-codeception", @@ -7424,153 +7424,6 @@ "abandoned": true, "time": "2020-01-10T10:52:12+00:00" }, - { - "name": "codeception/aspect-mock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/Codeception/AspectMock.git", - "reference": "eef5e5e9ebd66c89d6184416e83851c354963e9c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Codeception/AspectMock/zipball/eef5e5e9ebd66c89d6184416e83851c354963e9c", - "reference": "eef5e5e9ebd66c89d6184416e83851c354963e9c", - "shasum": "" - }, - "require": { - "goaop/framework": "^2.2.0", - "php": "^7.0", - "phpunit/phpunit": "> 6.0.0", - "symfony/finder": ">=2.4 <6.0" - }, - "require-dev": { - "codeception/codeception": "^4.0", - "codeception/specify": "^1.0", - "codeception/verify": "^1.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "AspectMock": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Bodnarchuk", - "email": "davert@codeception.com" - } - ], - "description": "Experimental Mocking Framework powered by Aspects", - "support": { - "issues": "https://github.com/Codeception/AspectMock/issues", - "source": "https://github.com/Codeception/AspectMock/tree/3.1.1" - }, - "time": "2021-04-10T19:47:51+00:00" - }, - { - "name": "doctrine/cache", - "version": "1.11.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "3bb5588cec00a0268829cc4a518490df6741af9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/3bb5588cec00a0268829cc4a518490df6741af9d", - "reference": "3bb5588cec00a0268829cc4a518490df6741af9d", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4", - "psr/cache": ">=3" - }, - "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "predis/predis": "~1.0", - "psr/cache": "^1.0 || ^2.0", - "symfony/cache": "^4.4 || ^5.2" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/1.11.3" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2021-05-25T09:01:55+00:00" - }, { "name": "gitonomy/gitlib", "version": "v1.2.3", @@ -7641,198 +7494,6 @@ ], "time": "2020-12-29T16:48:45+00:00" }, - { - "name": "goaop/framework", - "version": "2.3.5", - "source": { - "type": "git", - "url": "https://github.com/goaop/framework.git", - "reference": "19a6f2110c71aed99081ca23c359436b723a6cdf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/goaop/framework/zipball/19a6f2110c71aed99081ca23c359436b723a6cdf", - "reference": "19a6f2110c71aed99081ca23c359436b723a6cdf", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.2.3", - "doctrine/cache": "^1.5", - "goaop/parser-reflection": "~2.0", - "jakubledl/dissect": "~1.0", - "php": "~7.0", - "symfony/finder": "^3.4|^4.2|^5.0" - }, - "require-dev": { - "adlawson/vfs": "^0.12", - "doctrine/orm": "^2.5", - "phpunit/phpunit": "^5.7", - "symfony/console": "^2.7|^3.0", - "symfony/filesystem": "^3.3", - "symfony/process": "^3.3", - "webmozart/glob": "^4.1" - }, - "suggest": { - "symfony/console": "Enables the usage of the command-line tool." - }, - "bin": [ - "bin/aspect" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Go\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Lisachenko Alexander", - "homepage": "https://github.com/lisachenko" - } - ], - "description": "Framework for aspect-oriented programming in PHP.", - "homepage": "http://go.aopphp.com/", - "keywords": [ - "aop", - "aspect", - "library", - "php" - ], - "support": { - "issues": "https://github.com/goaop/framework/issues", - "source": "https://github.com/goaop/framework/tree/2.3.5" - }, - "funding": [ - { - "url": "https://github.com/lisachenko", - "type": "github" - } - ], - "time": "2021-06-11T16:17:30+00:00" - }, - { - "name": "goaop/parser-reflection", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/goaop/parser-reflection.git", - "reference": "2e837e150e15d38f7004b0dbcd0af4abe034c9e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/goaop/parser-reflection/zipball/2e837e150e15d38f7004b0dbcd0af4abe034c9e2", - "reference": "2e837e150e15d38f7004b0dbcd0af4abe034c9e2", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.0 <4.7.0", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Go\\ParserReflection\\": "src" - }, - "files": [ - "src/bootstrap.php" - ], - "exclude-from-classmap": [ - "/tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexander Lisachenko", - "email": "lisachenko.it@gmail.com" - } - ], - "description": "Provides reflection information, based on raw source", - "support": { - "issues": "https://github.com/goaop/parser-reflection/issues", - "source": "https://github.com/goaop/parser-reflection/tree/2.x" - }, - "time": "2020-08-13T21:02:42+00:00" - }, - { - "name": "jakubledl/dissect", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/jakubledl/dissect.git", - "reference": "d3a391de31e45a247e95cef6cf58a91c05af67c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jakubledl/dissect/zipball/d3a391de31e45a247e95cef6cf58a91c05af67c4", - "reference": "d3a391de31e45a247e95cef6cf58a91c05af67c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/console": "~2.1" - }, - "suggest": { - "symfony/console": "for the command-line tool" - }, - "bin": [ - "bin/dissect.php", - "bin/dissect" - ], - "type": "library", - "autoload": { - "psr-0": { - "Dissect": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "unlicense" - ], - "authors": [ - { - "name": "Jakub Lédl", - "email": "jakubledl@gmail.com" - } - ], - "description": "Lexing and parsing in pure PHP", - "homepage": "https://github.com/jakubledl/dissect", - "keywords": [ - "ast", - "lexing", - "parser", - "parsing" - ], - "support": { - "issues": "https://github.com/jakubledl/dissect/issues", - "source": "https://github.com/jakubledl/dissect/tree/v1.0.1" - }, - "time": "2013-01-29T21:29:14+00:00" - }, { "name": "pdepend/pdepend", "version": "2.9.1", diff --git a/dev/tests/_bootstrap.php b/dev/tests/_bootstrap.php index 9d3750ec6..3b31c6e4a 100644 --- a/dev/tests/_bootstrap.php +++ b/dev/tests/_bootstrap.php @@ -15,23 +15,6 @@ require_once $mftfTestCasePath; require_once $mftfStaticTestCasePath; -// Set up AspectMock -$kernel = \AspectMock\Kernel::getInstance(); -$kernel->init([ - 'debug' => true, - 'includePaths' => [ - PROJECT_ROOT . DIRECTORY_SEPARATOR . 'src', - PROJECT_ROOT . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'allure-framework' - ], - 'cacheDir' => PROJECT_ROOT . - DIRECTORY_SEPARATOR . - 'dev' . - DIRECTORY_SEPARATOR . - 'tests' . - DIRECTORY_SEPARATOR . - '.cache' -]); - // set mftf appplication context \Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::create( true, diff --git a/dev/tests/unit/Util/MagentoTestCase.php b/dev/tests/unit/Util/MagentoTestCase.php index bb38a0b5c..13c79403f 100644 --- a/dev/tests/unit/Util/MagentoTestCase.php +++ b/dev/tests/unit/Util/MagentoTestCase.php @@ -3,10 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace tests\unit\Util; -use AspectMock\Test as AspectMock; use PHPUnit\Framework\TestCase; /** @@ -14,24 +14,25 @@ */ class MagentoTestCase extends TestCase { + /** + * @inheritDoc + */ public static function setUpBeforeClass(): void { if (!self::fileExists(DOCS_OUTPUT_DIR)) { mkdir(DOCS_OUTPUT_DIR, 0755, true); } - // Should be used to clean AspectMock mocking before using PHPUnit mocking and Reflection. - AspectMock::clean(); + parent::setUpBeforeClass(); } /** - * Teardown for removing AspectMock Double References - * @return void + * @inheritDoc */ public static function tearDownAfterClass(): void { - AspectMock::clean(); array_map('unlink', glob(DOCS_OUTPUT_DIR . DIRECTORY_SEPARATOR . "*")); + if (file_exists(DOCS_OUTPUT_DIR)) { rmdir(DOCS_OUTPUT_DIR); } diff --git a/dev/tests/verification/Tests/SchemaValidationTest.php b/dev/tests/verification/Tests/SchemaValidationTest.php index c6187974c..e4e5aea40 100644 --- a/dev/tests/verification/Tests/SchemaValidationTest.php +++ b/dev/tests/verification/Tests/SchemaValidationTest.php @@ -6,8 +6,8 @@ namespace tests\verification\Tests; use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig; +use ReflectionProperty; use tests\util\MftfTestCase; -use AspectMock\Test as AspectMock; class SchemaValidationTest extends MftfTestCase { @@ -19,7 +19,11 @@ class SchemaValidationTest extends MftfTestCase */ public function testInvalidTestSchema() { - AspectMock::double(MftfApplicationConfig::class, ['getDebugLevel' => MftfApplicationConfig::LEVEL_DEVELOPER]); + $config = MftfApplicationConfig::getConfig(); + $property = new ReflectionProperty(MftfApplicationConfig::class, 'debugLevel'); + $property->setAccessible(true); + $property->setValue($config, MftfApplicationConfig::LEVEL_DEVELOPER); + $testFile = ['testFile.xml' => "a"]; $expectedError = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . @@ -32,11 +36,13 @@ public function testInvalidTestSchema() } /** - * After method functionality - * @return void + * @inheritdoc */ protected function tearDown(): void { - AspectMock::clean(); + $config = MftfApplicationConfig::getConfig(); + $property = new ReflectionProperty(MftfApplicationConfig::class, 'debugLevel'); + $property->setAccessible(true); + $property->setValue($config, MftfApplicationConfig::LEVEL_DEFAULT); } } diff --git a/dev/tests/verification/Tests/StaticCheck/DeprecationStaticCheckTest.php b/dev/tests/verification/Tests/StaticCheck/DeprecationStaticCheckTest.php index f6aef65f6..58875d660 100644 --- a/dev/tests/verification/Tests/StaticCheck/DeprecationStaticCheckTest.php +++ b/dev/tests/verification/Tests/StaticCheck/DeprecationStaticCheckTest.php @@ -5,9 +5,9 @@ */ namespace tests\verification\Tests; -use AspectMock\Test as AspectMock; use Magento\FunctionalTestingFramework\StaticCheck\DeprecatedEntityUsageCheck; use Magento\FunctionalTestingFramework\StaticCheck\StaticChecksList; +use ReflectionProperty; use Symfony\Component\Console\Input\InputInterface; use tests\util\MftfStaticTestCase; @@ -33,7 +33,9 @@ public function testDeprecatedEntityUsageCheck() $staticCheck = new DeprecatedEntityUsageCheck(); $input = $this->mockInputInterface(self::TEST_MODULE_PATH); - AspectMock::double(StaticChecksList::class, ['getErrorFilesPath' => self::STATIC_RESULTS_DIR]); + $property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath'); + $property->setAccessible(true); + $property->setValue(self::STATIC_RESULTS_DIR); /** @var InputInterface $input */ $staticCheck->execute($input); @@ -47,4 +49,14 @@ public function testDeprecatedEntityUsageCheck() self::LOG_FILE ); } + + /** + * @inheritdoc + */ + public function tearDown(): void + { + $property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath'); + $property->setAccessible(true); + $property->setValue(null); + } } diff --git a/dev/tests/verification/Tests/StaticCheck/PauseActionStaticCheckTest.php b/dev/tests/verification/Tests/StaticCheck/PauseActionStaticCheckTest.php index 7c8f77c2f..4c579b6c0 100644 --- a/dev/tests/verification/Tests/StaticCheck/PauseActionStaticCheckTest.php +++ b/dev/tests/verification/Tests/StaticCheck/PauseActionStaticCheckTest.php @@ -5,11 +5,11 @@ */ namespace tests\verification\Tests; -use AspectMock\Test as AspectMock; +use Exception; use Magento\FunctionalTestingFramework\StaticCheck\PauseActionUsageCheck; use Magento\FunctionalTestingFramework\StaticCheck\StaticChecksList; +use ReflectionProperty; use Symfony\Component\Console\Input\InputInterface; - use tests\util\MftfStaticTestCase; class PauseActionStaticCheckTest extends MftfStaticTestCase @@ -27,14 +27,17 @@ class PauseActionStaticCheckTest extends MftfStaticTestCase /** * test static-check PauseActionUsageCheck. * - * @throws \Exception + * @throws Exception */ public function testPauseActionUsageCheck() { $staticCheck = new PauseActionUsageCheck(); $input = $this->mockInputInterface(self::TEST_MODULE_PATH); - AspectMock::double(StaticChecksList::class, ['getErrorFilesPath' => self::STATIC_RESULTS_DIR]); + + $property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath'); + $property->setAccessible(true); + $property->setValue(self::STATIC_RESULTS_DIR); /** @var InputInterface $input */ $staticCheck->execute($input); @@ -48,4 +51,14 @@ public function testPauseActionUsageCheck() self::LOG_FILE ); } + + /** + * @inheritdoc + */ + public static function tearDownAfterClass(): void + { + $property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath'); + $property->setAccessible(true); + $property->setValue(null); + } }