-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
149 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Abstract base class to encapsulate funcationality common to unit tests. | ||
*/ | ||
|
||
namespace UnitTesting; | ||
|
||
abstract class BaseTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Recursively filter out any keys matching one in $keyList. This is a helper function to | ||
* address the issue specified in Asana https://app.asana.com/0/807629084565719/1101232922862525 | ||
* where the key generated for JSON file DataEndpoints is unstable. Note that 2-dimensional | ||
* arrays are not handled. | ||
* | ||
* @param array $keyList The list of keys to remove | ||
* @param array $input The input object being filtered. | ||
* | ||
* @return array The filtered object with specified keys removed | ||
*/ | ||
|
||
protected function filterKeysRecursive(array $keyList, \stdClass $input) | ||
{ | ||
foreach ($input as $key => &$value) | ||
{ | ||
if ( in_array($key, $keyList) ) { | ||
unset($input->$key); | ||
} elseif ( is_object($value) ) { | ||
$this->filterKeysRecursive($keyList, $value); | ||
} elseif ( is_array($value) ) { | ||
foreach ( $value as $element ) { | ||
if ( is_object($element) ) { | ||
$this->filterKeysRecursive($keyList, $element); | ||
} | ||
} | ||
} | ||
} | ||
return $input; | ||
} | ||
} // BaseTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...s/xdmod-test-artifacts/xdmod/etlv2/configuration/input/etl_sql.d/query_with_variables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT | ||
name, | ||
description | ||
FROM ${SOURCE_SCHEMA}.jobs j | ||
WHERE 1; |
5 changes: 5 additions & 0 deletions
5
.../artifacts/xdmod-test-artifacts/xdmod/etlv2/configuration/input/rfc6901_bad_fragment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"reference": { | ||
"$ref": "reference_target.json#/does-not-exist" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...ts/xdmod-test-artifacts/xdmod/etlv2/configuration/input/sample_config_with_reference.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"subreference": { | ||
"$ref": "file://${TMPDIR}/sample_config_with_variables.json#/key_two" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...d-test-artifacts/xdmod/etlv2/configuration/input/sample_config_with_transformer_keys.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"reference": { | ||
"$ref": "file://${TMPDIR}/sample_config_with_variables.json#/key_one" | ||
}, | ||
"include": { | ||
"#": "Implicit file reference", | ||
"$include": "${SQLDIR}/query_with_variables.sql" | ||
}, | ||
"reference_with_subreference": { | ||
"$ref": "file://${TMPDIR}/sample_config_with_reference.json" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...t-artifacts/xdmod/etlv2/configuration/output/sample_config_with_transformer_keys.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"reference":{"name":"resource_allocations","engine":"MyISAM","columns":[{"name":"resource","type":"varchar(40)","nullable":true}]},"include":"\"SELECT\\n name,\\n description\\nFROM modw.jobs j\\nWHERE 1;\\n\"","reference_with_subreference":{"subreference":[{"object1":"value"},{"object2":"value"}]}} |
2 changes: 1 addition & 1 deletion
2
...dmod-test-artifacts/xdmod/etlv2/configuration/output/xdmod_etl_config_with_variables.json
Large diffs are not rendered by default.
Oops, something went wrong.