Skip to content

Commit

Permalink
Merge pull request #102 from k00ni/sparql11-compliance-tests
Browse files Browse the repository at this point in the history
Added SPARQL 1.1 compliance tests (incomplete)
  • Loading branch information
semsol authored Jan 9, 2018
2 parents b7f5afb + 9882691 commit 1bb23a0
Show file tree
Hide file tree
Showing 214 changed files with 5,311 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- nightly

matrix:
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0"
"doctrine/instantiator": "1.0.*",
"phpunit/phpunit": "^5.0",
"symfony/yaml": "2.*"
},
"autoload": {
"classmap": ["parsers/", "serializers/"],
Expand Down
11 changes: 9 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@
<php>
<ini name="error_reporting" value="-1" />
<ini name="intl.error_level" value="0" />
<ini name="display_errors" value="On"/>
</php>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
<testsuite name="integration">
<directory suffix="Test.php">./tests/integration</directory>
</testsuite>
<testsuite name="sparql11">
<directory suffix="Test.php">./tests/sparql11</directory>
</testsuite>
<testsuite name="unit">
<directory suffix="Test.php">./tests/unit</directory>
</testsuite>
</testsuites>
</phpunit>
12 changes: 12 additions & 0 deletions tests/ARC2_TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@

class ARC2_TestCase extends \PHPUnit\Framework\TestCase
{
/**
* Store configuration to connect with the database.
*
* @var array
*/
protected $dbConfig;

/**
* Subject under test.
*
* @var mixed
*/
protected $fixture;

public function setUp()
{
global $dbConfig;
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require_once __DIR__ .'/../vendor/autoload.php';

error_reporting(E_ALL);

require 'ARC2_TestHandler.php';

global $dbConfig;
Expand Down
275 changes: 275 additions & 0 deletions tests/sparql11/AggregatesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
<?php

namespace Tests\sparql11;

/**
* Runs W3C tests from https://www.w3.org/2009/sparql/docs/tests/
*
* Version: 2012-10-23 20:52 (sparql11-test-suite-20121023.tar.gz)
*
* Tests are located in the w3c-tests folder.
*/
class AggregatesTest extends ComplianceTest
{
public function setUp()
{
parent::setUp();

$this->w3cTestsFolderPath = __DIR__.'/w3c-tests/aggregates';
$this->testPref = 'http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#';
}

/*
* tests
*/

public function test_agg_avg_01()
{
$this->markTestSkipped(
'Test skipped, because of rounding bug in AVG function. See https://github.com/semsol/arc2/issues/99'
);
}

public function test_agg_avg_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-avg-02');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_empty_group()
{
$this->runTestFor('agg-empty-group');
}

public function test_agg_err_01()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-err-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_err_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-err-02');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_groupconcat_01()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-groupconcat-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_groupconcat_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-groupconcat-02');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_groupconcat_03()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-groupconcat-03');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_max_01()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-max-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'Result is empty and misses entry:'
. PHP_EOL
. '<binding name="max">'
. '<literal datatype="http://www.w3.org/2001/XMLSchema#double">3.0E4</literal>'
. '</binding>'
. PHP_EOL
. 'for query: '.
$this->makeQueryA1Liner($query)
);
}

public function test_agg_max_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-max-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'Result is missing multiple entries.'
. PHP_EOL
. 'for query: '.
$this->makeQueryA1Liner($query)
);
}

public function test_agg_min_01()
{
$this->runTestFor('agg-min-01');
}

public function test_agg_min_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-min-02');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'Result is missing multiple entries.'
. PHP_EOL
. 'for query: '.
$this->makeQueryA1Liner($query)
);
}

public function test_agg_sample_01()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-sample-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_sum_01()
{
$this->markTestSkipped(
'Test skipped, because of rounding bug in SUM function. See https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg01()
{
$this->runTestFor('agg01');
}

public function test_agg02()
{
$this->runTestFor('agg02');
}

public function test_agg03()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg03');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg04()
{
$this->runTestFor('agg04');
}

public function test_agg05()
{
$this->runTestFor('agg05');
}

public function test_agg06()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg06');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg07()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg07');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg08()
{
$this->runTestFor('agg08');
}

public function test_agg08b()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg08b');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg09()
{
$this->runTestFor('agg09');
}

public function test_agg10()
{
$this->runTestFor('agg10');
}

public function test_agg11()
{
$this->runTestFor('agg11');
}

public function test_agg12()
{
$this->runTestFor('agg12');
}
}
Loading

0 comments on commit 1bb23a0

Please sign in to comment.