|
4 | 4 |
|
5 | 5 | use IntegrationTests\TestHarness\Utilities;
|
6 | 6 | use IntegrationTests\TestHarness\XdmodTestHelper;
|
| 7 | +use ReflectionClass; |
7 | 8 |
|
8 | 9 | class MetricExplorerChartsTest extends \PHPUnit_Framework_TestCase
|
9 | 10 | {
|
@@ -425,11 +426,7 @@ public function remainderChartProvider()
|
425 | 426 | private function generateFilterTests()
|
426 | 427 | {
|
427 | 428 | // Generate test scenario for filter tests.
|
428 |
| - $baseConfig = array( |
429 |
| - array('realm' => 'Jobs', 'metric' => 'total_cpu_hours', 'date' => '2016-12-31'), |
430 |
| - array('realm' => 'Storage', 'metric' => 'avg_logical_usage', 'date' => '2018-12-28'), |
431 |
| - array('realm' => 'Cloud', 'metric' => 'cloud_core_time', 'date' => '2019-06-26') |
432 |
| - ); |
| 429 | + $baseConfig = static::getFilterTestBaseConfig(); |
433 | 430 |
|
434 | 431 | $output = array();
|
435 | 432 |
|
@@ -476,9 +473,37 @@ private function generateFilterTests()
|
476 | 473 | return $output;
|
477 | 474 | }
|
478 | 475 |
|
| 476 | + /** |
| 477 | + * This method is overridden by modules (SUPREMM, OnDemand). |
| 478 | + */ |
| 479 | + protected static function getFilterTestBaseConfig() |
| 480 | + { |
| 481 | + return [ |
| 482 | + [ |
| 483 | + 'realm' => 'Jobs', |
| 484 | + 'metric' => 'total_cpu_hours', |
| 485 | + 'date' => '2016-12-31' |
| 486 | + ], |
| 487 | + [ |
| 488 | + 'realm' => 'Storage', |
| 489 | + 'metric' => 'avg_logical_usage', |
| 490 | + 'date' => '2018-12-28' |
| 491 | + ], |
| 492 | + [ |
| 493 | + 'realm' => 'Cloud', |
| 494 | + 'metric' => 'cloud_core_time', |
| 495 | + 'date' => '2019-06-26' |
| 496 | + ] |
| 497 | + ]; |
| 498 | + } |
| 499 | + |
479 | 500 | public function filterTestsProvider()
|
480 | 501 | {
|
481 |
| - $data_file = realpath(__DIR__ . '/../../../artifacts/xdmod/regression/chartFilterTests.json'); |
| 502 | + $testClass = new ReflectionClass($this); |
| 503 | + $data_file = realpath( |
| 504 | + dirname($testClass->getFilename()) |
| 505 | + . '/../../../artifacts/xdmod/regression/chartFilterTests.json' |
| 506 | + ); |
482 | 507 | if (file_exists($data_file)) {
|
483 | 508 | $inputs = json_decode(file_get_contents($data_file), true);
|
484 | 509 | } else {
|
|
0 commit comments