Skip to content

Commit

Permalink
Merge pull request #1387 from SemanticMediaWiki/dat-test
Browse files Browse the repository at this point in the history
Add extra `_dat` input/output integration test
  • Loading branch information
mwjames committed Jan 24, 2016
2 parents 5705a32 + e80f54e commit 944e8c0
Show file tree
Hide file tree
Showing 5 changed files with 654 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tests/phpunit/ByJsonTestCaseProvider.php
Expand Up @@ -60,6 +60,11 @@ abstract class ByJsonTestCaseProvider extends MwDBaseUnitTestCase {
*/
protected $deleteAfterState = true;

/**
* @var string
*/
protected $connectorId = '';

protected function setUp() {
parent::setUp();

Expand All @@ -70,6 +75,12 @@ protected function setUp() {
$this->fileReader = $utilityFactory->newJsonFileReader( null );
$this->pageCreator = $utilityFactory->newPageCreator();
$this->pageDeleter = $utilityFactory->newPageDeleter();

if ( $this->getStore() instanceof \SMWSparqlStore ) {
$this->connectorId = strtolower( $GLOBALS['smwgSparqlDatabaseConnector'] );
} else {
$this->connectorId = strtolower( $this->getDBConnection()->getType() );
}
}

protected function tearDown() {
Expand Down Expand Up @@ -122,6 +133,12 @@ protected function createPagesFor( array $pages, $defaultNamespace ) {

foreach ( $pages as $page ) {

$skipOn = isset( $page['skip-on'] ) ? $page['skip-on'] : array();

if ( in_array( $this->connectorId, array_keys( $skipOn ) ) ) {
continue;
}

if ( !isset( $page['name'] ) || !isset( $page['contents'] ) ) {
continue;
}
Expand Down
Expand Up @@ -173,6 +173,11 @@ private function tryToProcessParserTestCase( $jsonTestCaseFileHandler ) {
);

foreach ( $jsonTestCaseFileHandler->findTestCasesFor( 'parser-testcases' ) as $case ) {

if ( $jsonTestCaseFileHandler->requiredToSkipFor( $case, $this->connectorId ) ) {
continue;
}

$this->parserTestCaseProcessor->process( $case );
}
}
Expand Down

0 comments on commit 944e8c0

Please sign in to comment.