Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SPARQL 1.1 compliance tests (incomplete) #102

Merged
merged 20 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f55e6e7
test environment: preparations for further changes
k00ni Dec 15, 2017
d681f4e
added test class to cover grouping folder
k00ni Dec 15, 2017
b1d16f5
moved compliance tests to ComplianceTest class; lightened GroupingTes…
k00ni Dec 15, 2017
1cc71c1
added compliance test for move folder
k00ni Dec 15, 2017
523428f
try to fix failing travis tests
k00ni Dec 15, 2017
c3edcaf
another attempt to fix travis (php 5.6)
k00ni Dec 15, 2017
2a0c738
added compliance test for construct folder
k00ni Dec 15, 2017
3cb5972
refinements in ComplianceTest; added incomplete AggregatesTest
k00ni Dec 15, 2017
6b3ff97
travis: added PHP 7.2 as backend
k00ni Dec 15, 2017
8a1e551
added further aggregates tests
k00ni Dec 16, 2017
2d2c31e
ComplianceTest: removed createGraph function; added FROM clause to te…
k00ni Dec 16, 2017
fba9153
AggregatesTest: finished folder; fixed existing tests
k00ni Dec 16, 2017
dac2751
added compliance test for delete folder
k00ni Dec 16, 2017
6aaef3e
ComplianceTest.php: apply FROM clause only for ASK, CONSTRUCT and SEL…
k00ni Dec 16, 2017
31c4640
added compliance tests for drop folder
k00ni Dec 16, 2017
dc1e1a0
added compliance tests for exists folder
k00ni Dec 16, 2017
aa8cb31
ComplianceTest: close DB connection after each test to avoid too-many…
k00ni Dec 16, 2017
b82ad63
ComplianceTest: removed newline in makeQueryA1Liner
k00ni Dec 16, 2017
bcadfca
added compliance tests for syntax-update-1 folder
k00ni Dec 16, 2017
9882691
added further information on some tests; changed meaning of tests in …
k00ni Dec 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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