From: =?utf-8?q?David_Pr=C3=A9vot?= <david@tilapin.org>
Date: Wed, 8 Jun 2022 10:37:44 +0200
Subject: Compatibility with current PHPUnit

---
 Test/DocumentTest.php              |  4 ++--
 Test/EarlReportGenerator.php       | 30 +++++++++++++++---------------
 Test/FileGetContentsLoaderTest.php |  6 +++---
 Test/GraphTest.php                 | 16 ++++++----------
 Test/JsonTestCase.php              |  2 +-
 Test/NQuadsTest.php                | 14 +++++---------
 Test/ValueTest.php                 | 14 +++++---------
 7 files changed, 37 insertions(+), 49 deletions(-)

diff --git a/Test/DocumentTest.php b/Test/DocumentTest.php
index 72115d2..f12b646 100644
--- a/Test/DocumentTest.php
+++ b/Test/DocumentTest.php
@@ -17,7 +17,7 @@ use ML\JsonLD\Document;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-class DocumentTest extends \PHPUnit_Framework_TestCase
+class DocumentTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * The document instance being used throughout the tests.
@@ -29,7 +29,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
     /**
      * Create the document to test.
      */
-    protected function setUp()
+    protected function setUp(): void
     {
         $this->document = JsonLD::getDocument(
             dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'dataset.jsonld',
diff --git a/Test/EarlReportGenerator.php b/Test/EarlReportGenerator.php
index 6ba34b5..2cb82a9 100644
--- a/Test/EarlReportGenerator.php
+++ b/Test/EarlReportGenerator.php
@@ -56,7 +56,7 @@ namespace ML\JsonLD\Test;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-class EarlReportGenerator extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_TestListener
+class EarlReportGenerator extends \PHPUnit\Util\Printer implements \PHPUnit\Framework\TestListener
 {
     /**
      * @var string
@@ -109,11 +109,11 @@ class EarlReportGenerator extends \PHPUnit_Util_Printer implements \PHPUnit_Fram
         $this->options = $options;
 
         $this->earlStatuses = array(
-            \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED     => 'earl:passed',
-            \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED    => 'earl:untested',
-            \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE => 'earl:cantTell',
-            \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE    => 'earl:failed',
-            \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR      => 'earl:failed'
+            \PHPUnit\Runner\BaseTestRunner::STATUS_PASSED     => 'earl:passed',
+            \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED    => 'earl:untested',
+            \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE => 'earl:cantTell',
+            \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE    => 'earl:failed',
+            \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR      => 'earl:failed'
         );
 
         $this->assertions = array();
@@ -124,10 +124,10 @@ class EarlReportGenerator extends \PHPUnit_Util_Printer implements \PHPUnit_Fram
     /**
      * A test ended.
      *
-     * @param \PHPUnit_Framework_Test $test
+     * @param \PHPUnit\Framework\Test $test
      * @param float                   $time
      */
-    public function endTest(\PHPUnit_Framework_Test $test, $time)
+    public function endTest(\PHPUnit\Framework\Test $test, $time)
     {
         if (false === ($test instanceof $this->testTypeOfInterest)) {
             return;
@@ -225,49 +225,49 @@ class EarlReportGenerator extends \PHPUnit_Util_Printer implements \PHPUnit_Fram
     /**
      * @inheritdoc
      */
-    public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
+    public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function endTestSuite(\PHPUnit_Framework_TestSuite $suite)
+    public function endTestSuite(\PHPUnit\Framework\TestSuite $suite)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time)
+    public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
+    public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
+    public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
+    public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
     {
     }
 
     /**
      * @inheritdoc
      */
-    public function startTest(\PHPUnit_Framework_Test $test)
+    public function startTest(\PHPUnit\Framework\Test $test)
     {
     }
 }
diff --git a/Test/FileGetContentsLoaderTest.php b/Test/FileGetContentsLoaderTest.php
index 8fcb873..91f0845 100644
--- a/Test/FileGetContentsLoaderTest.php
+++ b/Test/FileGetContentsLoaderTest.php
@@ -15,14 +15,14 @@ use ML\JsonLD\FileGetContentsLoader;
 /**
  * Test the parsing of a JSON-LD document into a Document.
  */
-class FileGetContentsLoaderTest extends \PHPUnit_Framework_TestCase
+class FileGetContentsLoaderTest extends \PHPUnit\Framework\TestCase
 {
 
     protected $iri;
 
     protected $loader;
 
-    public function setUp()
+    public function setUp(): void
     {
         parent::setUp();
 
@@ -30,7 +30,7 @@ class FileGetContentsLoaderTest extends \PHPUnit_Framework_TestCase
         $this->loader = new FileGetContentsLoader;
     }
 
-    public function tearDown()
+    public function tearDown(): void
     {
         unset($iri);
         unset($this->loader);
diff --git a/Test/GraphTest.php b/Test/GraphTest.php
index 8e452ab..41ba354 100644
--- a/Test/GraphTest.php
+++ b/Test/GraphTest.php
@@ -23,7 +23,7 @@ use ML\JsonLD\RdfConstants;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-class GraphTest extends \PHPUnit_Framework_TestCase
+class GraphTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * The graph instance being used throughout the tests.
@@ -40,7 +40,7 @@ class GraphTest extends \PHPUnit_Framework_TestCase
     /**
      * Create the graph to test.
      */
-    protected function setUp()
+    protected function setUp(): void
     {
         $json = <<<JSON_LD_DOCUMENT
 {
@@ -563,11 +563,10 @@ JSON_LD_DOCUMENT;
 
     /**
      * Tests whether it is possible to add invalid values
-     *
-     * @expectedException InvalidArgumentException
      */
     public function testAddInvalidPropertyValue()
     {
+        $this->expectException('InvalidArgumentException');
         $graph = new Graph();
         $newNode = $graph->createNode();
 
@@ -578,11 +577,10 @@ JSON_LD_DOCUMENT;
     /**
      * Tests whether it is possible to set the node's type to an invalid
      * value
-     *
-     * @expectedException InvalidArgumentException
      */
     public function testSetInvalidTypeValue()
     {
+        $this->expectException('InvalidArgumentException');
         $node1 = $this->graph->getNode('http://example.com/node/1');
         $node1->setType('http://vocab.com/type/aTypeAsString');
     }
@@ -590,11 +588,10 @@ JSON_LD_DOCUMENT;
     /**
      * Tests whether it is possible to set the node's type to an invalid
      * value when an array is used.
-     *
-     * @expectedException InvalidArgumentException
      */
     public function testSetInvalidTypeArray()
     {
+        $this->expectException('InvalidArgumentException');
         $types = array(
             $this->graph->getNode('http://vocab.com/type/nodeWithAliases'),
             'http://vocab.com/type/aTypeAsString'
@@ -608,11 +605,10 @@ JSON_LD_DOCUMENT;
     /**
      * Tests whether it is possible to add an type which is not part of the
      * graph
-     *
-     * @expectedException InvalidArgumentException
      */
     public function testAddTypeNotInGraph()
     {
+        $this->expectException('InvalidArgumentException');
         $graph = new Graph();
         $newType = $graph->createNode();
 
diff --git a/Test/JsonTestCase.php b/Test/JsonTestCase.php
index 8e8d0bd..a33f521 100644
--- a/Test/JsonTestCase.php
+++ b/Test/JsonTestCase.php
@@ -17,7 +17,7 @@ namespace ML\JsonLD\Test;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-abstract class JsonTestCase extends \PHPUnit_Framework_TestCase
+abstract class JsonTestCase extends \PHPUnit\Framework\TestCase
 {
     /**
      * Asserts that two JSON structures are equal.
diff --git a/Test/NQuadsTest.php b/Test/NQuadsTest.php
index 1dbfdf1..2167ca2 100644
--- a/Test/NQuadsTest.php
+++ b/Test/NQuadsTest.php
@@ -17,15 +17,14 @@ use ML\JsonLD\NQuads;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-class NQuadsTest extends \PHPUnit_Framework_TestCase
+class NQuadsTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * Tests that parsing an invalid NQuad file fails
-     *
-     * @expectedException \ML\JsonLD\Exception\InvalidQuadException
      */
     public function testInvalidParse()
     {
+        $this->expectException('\ML\JsonLD\Exception\InvalidQuadException');
         $nquads = new NQuads();
         $nquads->parse('Invalid NQuads file');
     }
@@ -73,33 +72,30 @@ class NQuadsTest extends \PHPUnit_Framework_TestCase
 
     /**
      * Tests that parsing fails for blank node labels beginning with "-"
-     *
-     * @expectedException \ML\JsonLD\Exception\InvalidQuadException
      */
     public function testParseBlankNodeDashAtTheBeginning()
     {
+	$this->expectException('\ML\JsonLD\Exception\InvalidQuadException');
         $nquads = new NQuads();
         $nquads->parse('_:-b1 <http://ex/1> "Test" .');
     }
 
     /**
      * Tests that parsing fails for blank node labels beginning with "."
-     *
-     * @expectedException \ML\JsonLD\Exception\InvalidQuadException
      */
     public function testParseBlankNodePeriodAtTheBeginning()
     {
+	$this->expectException('\ML\JsonLD\Exception\InvalidQuadException');
         $nquads = new NQuads();
         $nquads->parse('_:.b1 <http://ex/1> "Test" .');
     }
 
     /**
      * Tests that parsing fails for blank node labels ending with "."
-     *
-     * @expectedException \ML\JsonLD\Exception\InvalidQuadException
      */
     public function testParseBlankNodePeriodAtTheEnd()
     {
+	$this->expectException('\ML\JsonLD\Exception\InvalidQuadException');
         $nquads = new NQuads();
         $nquads->parse('_:b1. <http://ex/1> "Test" .');
     }
diff --git a/Test/ValueTest.php b/Test/ValueTest.php
index d4f5a00..df745cb 100644
--- a/Test/ValueTest.php
+++ b/Test/ValueTest.php
@@ -17,7 +17,7 @@ use ML\JsonLD\TypedValue;
  *
  * @author Markus Lanthaler <mail@markus-lanthaler.com>
  */
-class ValueTest extends \PHPUnit_Framework_TestCase
+class ValueTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * Tests LanguageTaggedString
@@ -39,22 +39,20 @@ class ValueTest extends \PHPUnit_Framework_TestCase
 
     /**
      * Tests LanguageTaggedString with an invalid value
-     *
-     * @expectedException \InvalidArgumentException
      */
     public function testLanguageTaggedStringInvalidValue()
     {
+        $this->expectException('InvalidArgumentException');
         $string1 = new LanguageTaggedString('value', 'language');
         $string1->setValue(1);
     }
 
     /**
      * Tests LanguageTaggedString with an invalid language
-     *
-     * @expectedException \InvalidArgumentException
      */
     public function testLanguageTaggedStringInvalidLanguage()
     {
+        $this->expectException('InvalidArgumentException');
         $string1 = new LanguageTaggedString('value', 'language');
         $string1->setLanguage(null);
     }
@@ -79,22 +77,20 @@ class ValueTest extends \PHPUnit_Framework_TestCase
 
     /**
      * Tests TypedValue with an invalid value
-     *
-     * @expectedException \InvalidArgumentException
      */
     public function testTypedValueInvalidValue()
     {
+        $this->expectException('InvalidArgumentException');
         $value1 = new LanguageTaggedString('value', 'language');
         $value1->setValue(1);
     }
 
     /**
      * Tests TypedValue with an invalid type
-     *
-     * @expectedException \InvalidArgumentException
      */
     public function testTypedValueInvalidLanguage()
     {
+        $this->expectException('InvalidArgumentException');
         $value1 = new TypedValue('value', 'http://example.com/type');
         $value1->setType(1);
     }
