Skip to content

Commit

Permalink
Merge branch 'pr-852' into imported-magento-magento2-functional-testi…
Browse files Browse the repository at this point in the history
…ng-framework-852
  • Loading branch information
jilu1 committed Aug 11, 2021
2 parents 432cd23 + 89812a2 commit a3905a0
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
use Magento\FunctionalTestingFramework\Filter\FilterList;
use Magento\FunctionalTestingFramework\ObjectManager;
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
use Magento\FunctionalTestingFramework\Test\Objects\TestHookObject;
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
use Magento\FunctionalTestingFramework\Util\Filesystem\CestFileCreatorUtil;
use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler;
use Magento\FunctionalTestingFramework\Util\ModuleResolver;
use Magento\FunctionalTestingFramework\Util\TestGenerator;
use ReflectionClass;
use ReflectionProperty;
use tests\unit\Util\MagentoTestCase;
use tests\unit\Util\TestLoggingUtil;
Expand Down Expand Up @@ -75,6 +77,8 @@ public function testEntityException(): void

$testObject = new TestObject('sampleTest', ['merge123' => $actionObject], [], [], 'filename');
$testGeneratorObject = TestGenerator::getInstance('', ['sampleTest' => $testObject]);
$this->mockTestObjectHandler();

$testGeneratorObject->createAllTestFiles(null, []);

// assert that no exception for createAllTestFiles and generation error is stored in GenerationErrorHandler
Expand Down Expand Up @@ -231,5 +235,25 @@ public static function tearDownAfterClass(): void
$mftfAppConfigInstance = new ReflectionProperty(MftfApplicationConfig::class, 'MFTF_APPLICATION_CONTEXT');
$mftfAppConfigInstance->setAccessible(true);
$mftfAppConfigInstance->setValue(null);

$property = new ReflectionProperty(TestObjectHandler::class, 'testObjectHandler');
$property->setAccessible(true);
$property->setValue(null);
}

/**
* Mock test object handler for test.
*/
private function mockTestObjectHandler(): void
{
$testObjectHandlerClass = new ReflectionClass(TestObjectHandler::class);
$testObjectHandlerConstructor = $testObjectHandlerClass->getConstructor();
$testObjectHandlerConstructor->setAccessible(true);
$testObjectHandler = $testObjectHandlerClass->newInstanceWithoutConstructor();
$testObjectHandlerConstructor->invoke($testObjectHandler);

$property = new ReflectionProperty(TestObjectHandler::class, 'testObjectHandler');
$property->setAccessible(true);
$property->setValue($testObjectHandler);
}
}

0 comments on commit a3905a0

Please sign in to comment.