Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / nikic / php-parser / test / PhpParser / ErrorTest.php
index 59e880c308a3bf9ed29350c5761159c4ee18b70e..4b9d73a16065f4d5b070b34d6a75059855f969c6 100644 (file)
@@ -1,14 +1,16 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace PhpParser;
 
-class ErrorTest extends \PHPUnit_Framework_TestCase
+use PHPUnit\Framework\TestCase;
+
+class ErrorTest extends TestCase
 {
     public function testConstruct() {
-        $attributes = array(
+        $attributes = [
             'startLine' => 10,
             'endLine' => 11,
-        );
+        ];
         $error = new Error('Some error', $attributes);
 
         $this->assertSame('Some error', $error->getRawMessage());
@@ -42,42 +44,42 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
 
     /** @dataProvider provideTestColumnInfo */
     public function testColumnInfo($code, $startPos, $endPos, $startColumn, $endColumn) {
-        $error = new Error('Some error', array(
+        $error = new Error('Some error', [
             'startFilePos' => $startPos,
             'endFilePos' => $endPos,
-        ));
+        ]);
 
-        $this->assertSame(true, $error->hasColumnInfo());
+        $this->assertTrue($error->hasColumnInfo());
         $this->assertSame($startColumn, $error->getStartColumn($code));
         $this->assertSame($endColumn, $error->getEndColumn($code));
 
     }
 
     public function provideTestColumnInfo() {
-        return array(
+        return [
             // Error at "bar"
-            array("<?php foo bar baz", 10, 12, 11, 13),
-            array("<?php\nfoo bar baz", 10, 12, 5, 7),
-            array("<?php foo\nbar baz", 10, 12, 1, 3),
-            array("<?php foo bar\nbaz", 10, 12, 11, 13),
-            array("<?php\r\nfoo bar baz", 11, 13, 5, 7),
+            ["<?php foo bar baz", 10, 12, 11, 13],
+            ["<?php\nfoo bar baz", 10, 12, 5, 7],
+            ["<?php foo\nbar baz", 10, 12, 1, 3],
+            ["<?php foo bar\nbaz", 10, 12, 11, 13],
+            ["<?php\r\nfoo bar baz", 11, 13, 5, 7],
             // Error at "baz"
-            array("<?php foo bar baz", 14, 16, 15, 17),
-            array("<?php foo bar\nbaz", 14, 16, 1, 3),
+            ["<?php foo bar baz", 14, 16, 15, 17],
+            ["<?php foo bar\nbaz", 14, 16, 1, 3],
             // Error at string literal
-            array("<?php foo 'bar\nbaz' xyz", 10, 18, 11, 4),
-            array("<?php\nfoo 'bar\nbaz' xyz", 10, 18, 5, 4),
-            array("<?php foo\n'\nbarbaz\n'\nxyz", 10, 19, 1, 1),
+            ["<?php foo 'bar\nbaz' xyz", 10, 18, 11, 4],
+            ["<?php\nfoo 'bar\nbaz' xyz", 10, 18, 5, 4],
+            ["<?php foo\n'\nbarbaz\n'\nxyz", 10, 19, 1, 1],
             // Error over full string
-            array("<?php", 0, 4, 1, 5),
-            array("<?\nphp", 0, 5, 1, 3),
-        );
+            ["<?php", 0, 4, 1, 5],
+            ["<?\nphp", 0, 5, 1, 3],
+        ];
     }
 
     public function testNoColumnInfo() {
         $error = new Error('Some error', 3);
 
-        $this->assertSame(false, $error->hasColumnInfo());
+        $this->assertFalse($error->hasColumnInfo());
         try {
             $error->getStartColumn('');
             $this->fail('Expected RuntimeException');
@@ -97,10 +99,10 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
      * @expectedExceptionMessage Invalid position information
      */
     public function testInvalidPosInfo() {
-        $error = new Error('Some error', array(
+        $error = new Error('Some error', [
             'startFilePos' => 10,
             'endFilePos' => 11,
-        ));
+        ]);
         $error->getStartColumn('code');
     }
 }