Update caching library to latest version, updated and fixed phpUnit tests
This commit is contained in:
@@ -8,7 +8,7 @@ namespace CloudObjects\SDK\AccountGateway;
|
||||
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class AAUIDParserTest extends \PHPUnit_Framework_TestCase {
|
||||
class AAUIDParserTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testValidAccountAAUID() {
|
||||
$aauid = new IRI('aauid:abcd1234abcd1234');
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CloudObjects\SDK\AccountGateway;
|
||||
use GuzzleHttp\Psr7\Request as GuzzlePsrRequest;
|
||||
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
|
||||
|
||||
class AccountContextParseTest extends \PHPUnit_Framework_TestCase {
|
||||
class AccountContextParseTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testParsePsrRequest() {
|
||||
$request = new GuzzlePsrRequest('GET', '/', [
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace CloudObjects\SDK\AccountGateway;
|
||||
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class AccountContextTest extends \PHPUnit_Framework_TestCase {
|
||||
class AccountContextTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $context;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->context = new AccountContext(new IRI('aauid:aaaabbbbccccdddd'), 'DUMMY');
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CloudObjects\SDK;
|
||||
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class COIDParserTest extends \PHPUnit_Framework_TestCase {
|
||||
class COIDParserTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testRootCOID() {
|
||||
$coid = new IRI('coid://example.com');
|
||||
|
||||
@@ -11,7 +11,7 @@ use GuzzleHttp\Client, GuzzleHttp\Handler\MockHandler,
|
||||
GuzzleHttp\HandlerStack, GuzzleHttp\Psr7\Response;
|
||||
use CloudObjects\SDK\ObjectRetriever;
|
||||
|
||||
class CryptoHelperTest extends \PHPUnit_Framework_TestCase {
|
||||
class CryptoHelperTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $retriever;
|
||||
private $graph;
|
||||
@@ -22,7 +22,7 @@ class CryptoHelperTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->retriever->setClient(new Client(['handler' => $handler]));
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->retriever = new ObjectRetriever([
|
||||
'auth_ns' => 'test.cloudobjects.io',
|
||||
'auth_secret' => 'TEST'
|
||||
|
||||
@@ -10,12 +10,12 @@ use InvalidArgumentException;
|
||||
use ML\JsonLD\JsonLD;
|
||||
use CloudObjects\SDK\ObjectRetriever;
|
||||
|
||||
class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
class SchemaValidatorTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $schemaValidator;
|
||||
private $graph;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->schemaValidator = new SchemaValidator(new ObjectRetriever);
|
||||
$this->graph = JsonLD::getDocument('{}')->getGraph();
|
||||
}
|
||||
@@ -24,10 +24,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/String'));
|
||||
$this->schemaValidator->validateAgainstNode("Test", $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotString() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/String'));
|
||||
@@ -38,10 +39,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Number'));
|
||||
$this->schemaValidator->validateAgainstNode(3.5, $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotNumber() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Number'));
|
||||
@@ -52,10 +54,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Integer'));
|
||||
$this->schemaValidator->validateAgainstNode(12, $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotInteger() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Integer'));
|
||||
@@ -66,10 +69,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Array'));
|
||||
$this->schemaValidator->validateAgainstNode([ 1, 2, "foo" ], $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotArray() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Array'));
|
||||
@@ -83,10 +87,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
'a' => 'A',
|
||||
'b' => 'B'
|
||||
], $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotObject() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$node = $this->graph->createNode();
|
||||
$node->setType($this->graph->createNode('coid://json.co-n.net/Object'));
|
||||
@@ -105,10 +110,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
'a' => 'A',
|
||||
'b' => 'B'
|
||||
], $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testObjectWithPropertyTypeError() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$stringNode = $this->graph->createNode();
|
||||
$stringNode->setProperty('coid://json.co-n.net/hasKey', 'a');
|
||||
@@ -136,10 +142,11 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
'a' => 'A',
|
||||
'b' => 'B'
|
||||
], $node);
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testObjectWithRequiredPropertyTypeError() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$stringNode = $this->graph->createNode();
|
||||
$stringNode->setProperty('coid://json.co-n.net/hasKey', 'a');
|
||||
@@ -156,7 +163,7 @@ class SchemaValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testObjectWithRequiredPropertyMissing() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$stringNode = $this->graph->createNode();
|
||||
$stringNode->setProperty('coid://json.co-n.net/hasKey', 'a');
|
||||
|
||||
@@ -10,7 +10,7 @@ use ML\IRI\IRI;
|
||||
use GuzzleHttp\Client, GuzzleHttp\Handler\MockHandler,
|
||||
GuzzleHttp\HandlerStack, GuzzleHttp\Psr7\Response;
|
||||
|
||||
class NodeReaderMockTest extends \PHPUnit_Framework_TestCase {
|
||||
class NodeReaderMockTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $retriever;
|
||||
private $reader;
|
||||
@@ -27,7 +27,7 @@ class NodeReaderMockTest extends \PHPUnit_Framework_TestCase {
|
||||
'{"@context":{"co":"coid:\/\/cloudobjects.io\/","rdf":"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#","agws":"coid:\/\/aauid.net\/","rdfs":"http:\/\/www.w3.org\/2000\/01\/rdf-schema#"},"@id":"coid:\/\/cloudobjects.io","@type":["agws:Service","co:Namespace"],"co:isAtRevision":"6-fbea0c90b2c5e5300e4039ed99be9b2d","co:isVisibleTo":{"@id":"co:Public"},"co:recommendsPrefix":"co","co:wasUpdatedAt":{"@type":"http:\/\/www.w3.org\/2001\/XMLSchema#dateTime","@value":"2017-01-16T17:29:22+00:00"},"rdfs:comment":"The CloudObjects namespace defines the essential objects.","rdfs:label":"CloudObjects"}'));
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->retriever = new ObjectRetriever;
|
||||
$this->reader = new NodeReader([
|
||||
'prefixes' => [
|
||||
|
||||
@@ -10,7 +10,7 @@ use ML\IRI\IRI;
|
||||
use GuzzleHttp\Client, GuzzleHttp\Handler\MockHandler,
|
||||
GuzzleHttp\HandlerStack, GuzzleHttp\Psr7\Response;
|
||||
|
||||
class ObjectRetrieverMockTest extends \PHPUnit_Framework_TestCase {
|
||||
class ObjectRetrieverMockTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $retriever;
|
||||
|
||||
@@ -20,7 +20,7 @@ class ObjectRetrieverMockTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->retriever->setClient(new Client(['handler' => $handler]));
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->retriever = new ObjectRetriever;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ use InvalidArgumentException;
|
||||
use ML\IRI\IRI;
|
||||
use CloudObjects\SDK\ObjectRetriever;
|
||||
|
||||
class SchemaValidatorPublicTest extends \PHPUnit_Framework_TestCase {
|
||||
class SchemaValidatorPublicTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $schemaValidator;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->schemaValidator = new SchemaValidator(new ObjectRetriever);
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@ class SchemaValidatorPublicTest extends \PHPUnit_Framework_TestCase {
|
||||
'region' => 'Hessen',
|
||||
'country-name' => 'Germany'
|
||||
], new IRI('coid://json.co-n.net/Address'));
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testNotAddress() {
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$this->schemaValidator->validateAgainstCOID([
|
||||
'region' => 'Hessen',
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace CloudObjects\SDK;
|
||||
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class ObjectRetrieverTest extends \PHPUnit_Framework_TestCase {
|
||||
class ObjectRetrieverPublicTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
private $retriever;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->retriever = new ObjectRetriever;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user