|
16 | 16 | use Magento\FunctionalTestingFramework\ObjectManager; |
17 | 17 | use Magento\FunctionalTestingFramework\ObjectManagerFactory; |
18 | 18 | use Magento\FunctionalTestingFramework\Util\MagentoTestCase; |
| 19 | +use tests\unit\Util\TestLoggingUtil; |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * Class PersistedObjectHandlerTest |
22 | 23 | */ |
23 | 24 | class PersistedObjectHandlerTest extends MagentoTestCase |
24 | 25 | { |
| 26 | + /** |
| 27 | + * Before test functionality |
| 28 | + * @return void |
| 29 | + */ |
| 30 | + public function setUp() |
| 31 | + { |
| 32 | + TestLoggingUtil::getInstance()->setMockLoggingUtil(); |
| 33 | + } |
| 34 | + |
25 | 35 | public function testCreateSimpleEntity() |
26 | 36 | { |
27 | 37 | // Test Data and Variables |
@@ -389,6 +399,8 @@ public function testRetrieveEntityValidField($name, $key, $value, $type, $scope, |
389 | 399 | public function testRetrieveEntityInValidField($name, $key, $value, $type, $scope, $stepKey) |
390 | 400 | { |
391 | 401 | $invalidDataKey = "invalidDataKey"; |
| 402 | + $warnMsg = "Undefined field {$invalidDataKey} in entity object with a stepKey of {$stepKey}\n"; |
| 403 | + $warnMsg .= "Please fix the invalid reference. This will result in fatal error in next major release."; |
392 | 404 |
|
393 | 405 | $parserOutputOne = [ |
394 | 406 | 'entity' => [ |
@@ -416,10 +428,15 @@ public function testRetrieveEntityInValidField($name, $key, $value, $type, $scop |
416 | 428 | $this->mockCurlHandler($jsonReponseOne); |
417 | 429 | $handler->createEntity($stepKey, $scope, $name); |
418 | 430 |
|
419 | | - $this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestReferenceException::class); |
420 | | - |
421 | 431 | // Call method |
422 | 432 | $handler->retrieveEntityField($stepKey, $invalidDataKey, $scope); |
| 433 | + |
| 434 | + // validate log statement |
| 435 | + TestLoggingUtil::getInstance()->validateMockLogStatement( |
| 436 | + "warning", |
| 437 | + $warnMsg, |
| 438 | + [] |
| 439 | + ); |
423 | 440 | } |
424 | 441 |
|
425 | 442 | /** |
@@ -478,4 +495,14 @@ public function tearDown() |
478 | 495 |
|
479 | 496 | parent::tearDown(); // TODO: Change the autogenerated stub |
480 | 497 | } |
| 498 | + |
| 499 | + /** |
| 500 | + * After class functionality |
| 501 | + * @return void |
| 502 | + */ |
| 503 | + public static function tearDownAfterClass() |
| 504 | + { |
| 505 | + TestLoggingUtil::getInstance()->clearMockLoggingUtil(); |
| 506 | + parent::tearDownAfterClass(); |
| 507 | + } |
481 | 508 | } |
0 commit comments