|
24 | 24 | use tests\unit\Util\MagentoTestCase;
|
25 | 25 | use tests\unit\Util\TestDataArrayBuilder;
|
26 | 26 | use tests\unit\Util\TestLoggingUtil;
|
| 27 | +use Magento\FunctionalTestingFramework\Filter\FilterList; |
| 28 | +use Magento\FunctionalTestingFramework\Util\Script\TestDependencyUtil; |
27 | 29 |
|
28 | 30 | class TestObjectHandlerTest extends MagentoTestCase
|
29 | 31 | {
|
@@ -447,4 +449,55 @@ function (
|
447 | 449 | $property->setAccessible(true);
|
448 | 450 | $property->setValue($resolver, $paths);
|
449 | 451 | }
|
| 452 | + |
| 453 | + /** |
| 454 | + * Basic test for exclude group Filter |
| 455 | + * |
| 456 | + * @return void |
| 457 | + * @throws Exception |
| 458 | + */ |
| 459 | + public function testGetFilteredTestNamesWhenExcludeGroupFilterIsApplied() |
| 460 | + { |
| 461 | + $fileList = new FilterList(['excludeGroup' => ['test']]); |
| 462 | + $toh = TestObjectHandler::getInstance()->getAllObjects(); |
| 463 | + $testDependencyUtil = new TestDependencyUtil(); |
| 464 | + $result = $testDependencyUtil->getFilteredTestNames($toh, $fileList->getFilters()); |
| 465 | + $this->assertIsArray($result); |
| 466 | + $this->assertEquals(count($result), 0); |
| 467 | + } |
| 468 | + |
| 469 | + /** |
| 470 | + * Basic test for include group Filter |
| 471 | + * |
| 472 | + * @return void |
| 473 | + * @throws Exception |
| 474 | + */ |
| 475 | + public function testGetFilteredTestNamesWhenIncludeGroupFilterIsApplied() |
| 476 | + { |
| 477 | + $fileList = new FilterList(['includeGroup' => ['test']]); |
| 478 | + $toh = TestObjectHandler::getInstance()->getAllObjects(); |
| 479 | + $testDependencyUtil = new TestDependencyUtil(); |
| 480 | + $result = $testDependencyUtil->getFilteredTestNames($toh, $fileList->getFilters()); |
| 481 | + $this->assertIsArray($result); |
| 482 | + $this->assertEquals(count($result), 1); |
| 483 | + $this->assertEquals($result['testTest'], 'testTest'); |
| 484 | + } |
| 485 | + |
| 486 | + /** |
| 487 | + * Basic test when no filter applied |
| 488 | + * |
| 489 | + * @return void |
| 490 | + * @throws Exception |
| 491 | + */ |
| 492 | + public function testGetFilteredTestNamesWhenNoFilterIsApplied() |
| 493 | + { |
| 494 | + $fileList = new FilterList(); |
| 495 | + $toh = TestObjectHandler::getInstance()->getAllObjects(); |
| 496 | + $testDependencyUtil = new TestDependencyUtil(); |
| 497 | + $result = $testDependencyUtil->getFilteredTestNames($toh, $fileList->getFilters()); |
| 498 | + $this->assertIsArray($result); |
| 499 | + $this->assertEquals(count($result), 1); |
| 500 | + //returns all test Names |
| 501 | + $this->assertEquals($result['testTest'], 'testTest'); |
| 502 | + } |
450 | 503 | }
|
0 commit comments