diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ceca1e9d..645ef0ef 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: run: git config --system core.autocrlf false; git config --system core.eol lf - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up PHP ${{ matrix.php-versions }} uses: shivammathur/setup-php@v2 @@ -43,7 +43,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache dependencies - uses: actions/cache@v2.1.3 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -56,4 +56,4 @@ jobs: echo "vendor/autoload.php" > composer.pth - name: Run test suite - run: sh xp-run xp.unittest.TestRunner src/test/php + run: sh xp-run xp.test.Runner src/test/php diff --git a/composer.json b/composer.json index 5c312305..83462d56 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php" : ">=7.0.0" }, "require-dev" : { - "xp-framework/unittest": "^11.0 | ^10.0" + "xp-framework/test": "^1.0" }, "bin": ["bin/xp.xp-framework.compiler.compile", "bin/xp.xp-framework.compiler.ast"], "autoload" : { diff --git a/src/test/php/lang/ast/unittest/EmitterTest.class.php b/src/test/php/lang/ast/unittest/EmitterTest.class.php index 347ff56e..23050040 100755 --- a/src/test/php/lang/ast/unittest/EmitterTest.class.php +++ b/src/test/php/lang/ast/unittest/EmitterTest.class.php @@ -1,10 +1,10 @@ literal($type)); } - #[Test, Values('php71')] + #[Test, Values(from: 'php71')] public function php71_literals($type, $literal) { Assert::equals($literal, (new PHP71())->literal($type)); } - #[Test, Values('php72')] + #[Test, Values(from: 'php72')] public function php72_literals($type, $literal) { Assert::equals($literal, (new PHP72())->literal($type)); } - #[Test, Values('php74')] + #[Test, Values(from: 'php74')] public function php74_literals($type, $literal) { Assert::equals($literal, (new PHP74())->literal($type)); } - #[Test, Values('php80')] + #[Test, Values(from: 'php80')] public function php80_literals($type, $literal) { Assert::equals($literal, (new PHP80())->literal($type)); } - #[Test, Values('php81')] + #[Test, Values(from: 'php81')] public function php81_literals($type, $literal) { Assert::equals($literal, (new PHP81())->literal($type)); } - #[Test, Values('php82')] + #[Test, Values(from: 'php82')] public function php82_literals($type, $literal) { Assert::equals($literal, (new PHP82())->literal($type)); } diff --git a/src/test/php/lang/ast/unittest/cli/CompileOnlyTest.class.php b/src/test/php/lang/ast/unittest/cli/CompileOnlyTest.class.php index c62a8da3..f5590344 100755 --- a/src/test/php/lang/ast/unittest/cli/CompileOnlyTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/CompileOnlyTest.class.php @@ -1,6 +1,6 @@ folder->getURI()); } - #[Test, Values('files')] + #[Test, Values(from: 'files')] public function iteration($expected) { $results= []; foreach (new FromFilesIn($this->folder) as $path => $stream) { diff --git a/src/test/php/lang/ast/unittest/cli/FromInputsTest.class.php b/src/test/php/lang/ast/unittest/cli/FromInputsTest.class.php index 8c3e09c8..1832bbf0 100755 --- a/src/test/php/lang/ast/unittest/cli/FromInputsTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/FromInputsTest.class.php @@ -1,7 +1,7 @@ $stream) { diff --git a/src/test/php/lang/ast/unittest/cli/InputTest.class.php b/src/test/php/lang/ast/unittest/cli/InputTest.class.php index dc58270e..90d2b2c3 100755 --- a/src/test/php/lang/ast/unittest/cli/InputTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/InputTest.class.php @@ -2,9 +2,9 @@ use io\{File, Folder}; use lang\{Environment, IllegalArgumentException}; -use unittest\{Assert, After, Before, Expect, Test, Values}; +use test\{After, Assert, Before, Expect, Test, Values}; use util\cmd\Console; -use xp\compiler\{Input, FromStream, FromFile, FromFilesIn, FromInputs}; +use xp\compiler\{FromFile, FromFilesIn, FromInputs, FromStream, Input}; class InputTest { private $folder, $file; diff --git a/src/test/php/lang/ast/unittest/cli/OutputTest.class.php b/src/test/php/lang/ast/unittest/cli/OutputTest.class.php index 4821b25e..c4369971 100755 --- a/src/test/php/lang/ast/unittest/cli/OutputTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/OutputTest.class.php @@ -2,9 +2,9 @@ use io\{File, Folder}; use lang\Environment; -use unittest\{Assert, After, Before, Test, Values}; +use test\{After, Assert, Before, Test, Values}; use util\cmd\Console; -use xp\compiler\{Output, CompileOnly, ToStream, ToFile, ToArchive, ToFolder}; +use xp\compiler\{CompileOnly, Output, ToArchive, ToFile, ToFolder, ToStream}; class OutputTest { private $folder, $file, $archive; diff --git a/src/test/php/lang/ast/unittest/cli/ToArchiveTest.class.php b/src/test/php/lang/ast/unittest/cli/ToArchiveTest.class.php index 6b2067ef..53c19921 100755 --- a/src/test/php/lang/ast/unittest/cli/ToArchiveTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/ToArchiveTest.class.php @@ -3,7 +3,7 @@ use io\{File, Folder}; use lang\Environment; use lang\archive\ArchiveClassLoader; -use unittest\{After, Assert, Before, Test}; +use test\{After, Assert, Before, Test}; use xp\compiler\ToArchive; class ToArchiveTest { diff --git a/src/test/php/lang/ast/unittest/cli/ToFileTest.class.php b/src/test/php/lang/ast/unittest/cli/ToFileTest.class.php index 72be2ef4..43c2bef1 100755 --- a/src/test/php/lang/ast/unittest/cli/ToFileTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/ToFileTest.class.php @@ -3,7 +3,7 @@ use io\{File, Folder}; use lang\Environment; use lang\FileSystemClassLoader; -use unittest\{After, Assert, Before, Test}; +use test\{After, Assert, Before, Test}; use xp\compiler\ToFile; class ToFileTest { diff --git a/src/test/php/lang/ast/unittest/cli/ToFolderTest.class.php b/src/test/php/lang/ast/unittest/cli/ToFolderTest.class.php index 0c6d3c61..b3fe466c 100755 --- a/src/test/php/lang/ast/unittest/cli/ToFolderTest.class.php +++ b/src/test/php/lang/ast/unittest/cli/ToFolderTest.class.php @@ -1,9 +1,9 @@ type('class { public function __construct(private string... $in) { } diff --git a/src/test/php/lang/ast/unittest/emit/ArgumentUnpackingTest.class.php b/src/test/php/lang/ast/unittest/emit/ArgumentUnpackingTest.class.php index cbf78e8c..61dd3b98 100755 --- a/src/test/php/lang/ast/unittest/emit/ArgumentUnpackingTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/ArgumentUnpackingTest.class.php @@ -1,6 +1,6 @@ run('class { public function run() { diff --git a/src/test/php/lang/ast/unittest/emit/BlockTest.class.php b/src/test/php/lang/ast/unittest/emit/BlockTest.class.php index 37f58f37..d5eeee37 100755 --- a/src/test/php/lang/ast/unittest/emit/BlockTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/BlockTest.class.php @@ -1,6 +1,6 @@ run('class { public function run($arg) { @@ -167,7 +167,7 @@ public function run($arg) { }', SEEK_END); } - #[Test, Expect(class: Throwable::class, withMessage: '/Unknown seek mode .+/')] + #[Test, Expect(class: Throwable::class, message: '/Unknown seek mode .+/')] public function match_with_throw_expression() { $this->run('class { public function run($arg) { diff --git a/src/test/php/lang/ast/unittest/emit/DeclarationTest.class.php b/src/test/php/lang/ast/unittest/emit/DeclarationTest.class.php index 2c674f47..8cf02941 100755 --- a/src/test/php/lang/ast/unittest/emit/DeclarationTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/DeclarationTest.class.php @@ -3,7 +3,7 @@ use lang\ast\emit\Declaration; use lang\ast\nodes\{ClassDeclaration, Property}; use lang\ast\types\IsValue; -use unittest\{Assert, Before, Test, Expect}; +use test\{Assert, Before, Expect, Test}; class DeclarationTest { private $type; diff --git a/src/test/php/lang/ast/unittest/emit/DeclareTest.class.php b/src/test/php/lang/ast/unittest/emit/DeclareTest.class.php index 860ebd35..fd5623ed 100755 --- a/src/test/php/lang/ast/unittest/emit/DeclareTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/DeclareTest.class.php @@ -1,7 +1,7 @@ run('declare(strict_types = 1); class { public static function number(int $n) { return $n; } public function run() { return self::number("1"); } }'); } -} +} \ No newline at end of file diff --git a/src/test/php/lang/ast/unittest/emit/EchoTest.class.php b/src/test/php/lang/ast/unittest/emit/EchoTest.class.php index a6f1d87a..97b3215f 100755 --- a/src/test/php/lang/ast/unittest/emit/EchoTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/EchoTest.class.php @@ -1,6 +1,6 @@ null])] abstract class EmittingTest { private static $id= 0; private $cl, $language, $emitter, $output; diff --git a/src/test/php/lang/ast/unittest/emit/EnumTest.class.php b/src/test/php/lang/ast/unittest/emit/EnumTest.class.php index 28b93368..9c5019e5 100755 --- a/src/test/php/lang/ast/unittest/emit/EnumTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/EnumTest.class.php @@ -2,10 +2,10 @@ use lang\reflect\TargetInvocationException; use lang\{Enum, Error}; -use unittest\actions\VerifyThat; -use unittest\{Assert, Action, Ignore, Expect, Values, Test}; +use test\verify\Condition; +use test\{Action, Assert, Expect, Ignore, Test, Values}; -#[Action(eval: 'new VerifyThat(fn() => function_exists("enum_exists"))')] +#[Condition(assert: 'function_exists("enum_exists")')] class EnumTest extends EmittingTest { #[Test] @@ -138,7 +138,7 @@ public function backed_enum_from_string($arg, $expected) { Assert::equals($expected, $t->getMethod('from')->invoke(null, [$arg])->name); } - #[Test, Expect(class: Error::class, withMessage: '/"illegal" is not a valid backing value for enum .+/')] + #[Test, Expect(class: Error::class, message: '/"illegal" is not a valid backing value for enum .+/')] public function backed_enum_from_nonexistant() { $t= $this->type('enum : string { case ASC = "asc"; diff --git a/src/test/php/lang/ast/unittest/emit/EscapingTest.class.php b/src/test/php/lang/ast/unittest/emit/EscapingTest.class.php index 9a9e8e31..946b025c 100755 --- a/src/test/php/lang/ast/unittest/emit/EscapingTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/EscapingTest.class.php @@ -2,7 +2,7 @@ use io\streams\MemoryOutputStream; use lang\ast\emit\Escaping; -use unittest\{Assert, Test}; +use test\{Assert, Test}; class EscapingTest { diff --git a/src/test/php/lang/ast/unittest/emit/ExceptionsTest.class.php b/src/test/php/lang/ast/unittest/emit/ExceptionsTest.class.php index f55c529d..77ca0181 100755 --- a/src/test/php/lang/ast/unittest/emit/ExceptionsTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/ExceptionsTest.class.php @@ -1,7 +1,7 @@ run(sprintf('use lang\ast\unittest\emit\{FileInput, Handle}; class { const INITIAL= "initial"; @@ -39,7 +39,7 @@ public function run() { }', $declaration))); } - #[Test, Values('expressions')] + #[Test, Values(from: 'expressions')] public function reflective_access_to_property($declaration, $expected) { Assert::equals($expected, $this->run(sprintf('use lang\ast\unittest\emit\{FileInput, Handle}; class { const INITIAL= "initial"; diff --git a/src/test/php/lang/ast/unittest/emit/InstanceOfTest.class.php b/src/test/php/lang/ast/unittest/emit/InstanceOfTest.class.php index 0a62b39a..1659ceb3 100755 --- a/src/test/php/lang/ast/unittest/emit/InstanceOfTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/InstanceOfTest.class.php @@ -1,6 +1,6 @@ =8.1.0-dev")')] + #[Test, Runtime(php: '>=8.1.0-dev')] public function field_type_restriction_with_php81() { $t= $this->type('class { private Traversable&Countable $test; @@ -59,7 +59,7 @@ public function field_type_restriction_with_php81() { ); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.1.0-dev")')] + #[Test, Runtime(php: '>=8.1.0-dev')] public function parameter_type_restriction_with_php81() { $t= $this->type('class { public function test(Traversable&Countable $arg) { } @@ -71,7 +71,7 @@ public function test(Traversable&Countable $arg) { } ); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.1.0-dev")')] + #[Test, Runtime(php: '>=8.1.0-dev')] public function return_type_restriction_with_php81() { $t= $this->type('class { public function test(): Traversable&Countable { } diff --git a/src/test/php/lang/ast/unittest/emit/InvocationTest.class.php b/src/test/php/lang/ast/unittest/emit/InvocationTest.class.php index 17ac561f..b5ad3360 100755 --- a/src/test/php/lang/ast/unittest/emit/InvocationTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/InvocationTest.class.php @@ -1,7 +1,7 @@ =8.0")')] + #[Test, Runtime(php: '>=8.0')] public function named_arguments_in_reverse_order() { Assert::equals('html(<) = &lt;', $this->run( 'class { @@ -155,7 +155,7 @@ public function run() { )); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.0")')] + #[Test, Runtime(php: '>=8.0')] public function named_arguments_omitting_one() { Assert::equals('html(<) = <', $this->run( 'class { diff --git a/src/test/php/lang/ast/unittest/emit/LambdasTest.class.php b/src/test/php/lang/ast/unittest/emit/LambdasTest.class.php index d118bb24..8a0a1db0 100755 --- a/src/test/php/lang/ast/unittest/emit/LambdasTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/LambdasTest.class.php @@ -2,8 +2,8 @@ use lang\ast\Errors; use lang\ast\nodes\{ClosureExpression, LambdaExpression}; -use unittest\actions\VerifyThat; -use unittest\{Action, Assert, Expect, Test}; +use test\verify\Condition; +use test\{Action, Assert, Expect, Test}; /** * Lambdas (a.k.a. arrow functions) support @@ -48,7 +48,7 @@ public function run() { Assert::equals(3, $r(1)); } - #[Test, Action(eval: 'new VerifyThat(fn() => property_exists(LambdaExpression::class, "static"))')] + #[Test, Condition(assert: 'property_exists(LambdaExpression::class, "static")')] public function static_fn_does_not_capture_this() { $r= $this->run('class { public function run() { @@ -59,7 +59,7 @@ public function run() { Assert::false($r()); } - #[Test, Action(eval: 'new VerifyThat(fn() => property_exists(ClosureExpression::class, "static"))')] + #[Test, Condition(assert: 'property_exists(ClosureExpression::class, "static")')] public function static_function_does_not_capture_this() { $r= $this->run('class { public function run() { diff --git a/src/test/php/lang/ast/unittest/emit/LoopsTest.class.php b/src/test/php/lang/ast/unittest/emit/LoopsTest.class.php index ff8d74fa..ecba2112 100755 --- a/src/test/php/lang/ast/unittest/emit/LoopsTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/LoopsTest.class.php @@ -1,6 +1,6 @@ param('$param')->getType()); } - #[Test, Values('special')] + #[Test, Values(from: 'special')] public function with_special_type($declaration, $type) { Assert::equals($type, $this->param($declaration)->getType()); } @@ -73,7 +73,7 @@ public function nullable_string_type() { Assert::equals($this->nullable(Primitive::$STRING), $this->param('?string $param')->getType()); } - #[Test, Action(eval: 'new RuntimeVersion(">=7.1")')] + #[Test, Runtime(php: '>=7.1')] public function nullable_string_type_restriction() { Assert::equals($this->nullable(Primitive::$STRING), $this->param('?string $param')->getTypeRestriction()); } diff --git a/src/test/php/lang/ast/unittest/emit/PrecedenceTest.class.php b/src/test/php/lang/ast/unittest/emit/PrecedenceTest.class.php index b89c1c72..27bf9b57 100755 --- a/src/test/php/lang/ast/unittest/emit/PrecedenceTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/PrecedenceTest.class.php @@ -1,6 +1,6 @@ newInstance('Test')->fixture); } - #[Test, Values('modifiers')] + #[Test, Values(from: 'modifiers')] public function reading_from_class($modifiers) { $t= $this->type('class { public function __construct('.$modifiers.' readonly string $fixture) { } @@ -99,7 +99,7 @@ public function __construct(protected readonly string $fixture) { } Assert::equals('Test', $i->run()); } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access protected property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot access protected property .+fixture/')] public function cannot_read_protected() { $t= $this->type('class { public function __construct(protected readonly string $fixture) { } @@ -107,7 +107,7 @@ public function __construct(protected readonly string $fixture) { } $t->newInstance('Test')->fixture; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access protected property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot access protected property .+fixture/')] public function cannot_write_protected() { $t= $this->type('class { public function __construct(protected readonly string $fixture) { } @@ -115,7 +115,7 @@ public function __construct(protected readonly string $fixture) { } $t->newInstance('Test')->fixture= 'Modified'; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access private property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot access private property .+fixture/')] public function cannot_read_private() { $t= $this->type('class { public function __construct(private readonly string $fixture) { } @@ -123,7 +123,7 @@ public function __construct(private readonly string $fixture) { } $t->newInstance('Test')->fixture; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access private property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot access private property .+fixture/')] public function cannot_write_private() { $t= $this->type('class { public function __construct(private readonly string $fixture) { } @@ -151,7 +151,7 @@ public function can_be_assigned_via_reflection() { Assert::equals('Test', $i->fixture); } - #[Test, Expect(class: Error::class, withMessage: '/Cannot initialize readonly property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot initialize readonly property .+fixture/')] public function cannot_initialize_from_outside() { $t= $this->type('class { public readonly string $fixture; @@ -159,7 +159,7 @@ public function cannot_initialize_from_outside() { $t->newInstance()->fixture= 'Test'; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot modify readonly property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot modify readonly property .+fixture/')] public function cannot_be_set_after_initialization() { $t= $this->type('class { public function __construct(public readonly string $fixture) { } @@ -174,13 +174,13 @@ public function cannot_have_an_initial_value() { }'); } - #[Test, Expect(class: Error::class, withMessage: '/Cannot create dynamic property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot create dynamic property .+fixture/')] public function cannot_read_dynamic_members_from_readonly_classes() { $t= $this->type('readonly class { }'); $t->newInstance()->fixture; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot create dynamic property .+fixture/')] + #[Test, Expect(class: Error::class, message: '/Cannot create dynamic property .+fixture/')] public function cannot_write_dynamic_members_from_readonly_classes() { $t= $this->type('readonly class { }'); $t->newInstance()->fixture= true; diff --git a/src/test/php/lang/ast/unittest/emit/ReflectionTest.class.php b/src/test/php/lang/ast/unittest/emit/ReflectionTest.class.php index eb279197..e03fa8ff 100755 --- a/src/test/php/lang/ast/unittest/emit/ReflectionTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/ReflectionTest.class.php @@ -1,9 +1,9 @@ rewriteEnumCase('EMPTY')); } - #[Test, Action(eval: 'new RuntimeVersion("<8.1")')] + #[Test, Runtime(php: '<8.1')] public function rewrites_simulated_unit_enums() { $spec= ['kind' => 'class', 'extends' => null, 'implements' => [\UnitEnum::class], 'use' => []]; $t= ClassLoader::defineType('ReflectionTestSimulatedEnum', $spec, '{ @@ -58,7 +58,7 @@ static function __static() { Assert::false($reflect->rewriteEnumCase('EMPTY')); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.1")')] + #[Test, Runtime(php: '>=8.1')] public function does_not_rewrite_native_enums() { $spec= ['kind' => 'enum', 'extends' => null, 'implements' => [], 'use' => []]; $t= ClassLoader::defineType('ReflectionTestNativeEnum', $spec, '{ diff --git a/src/test/php/lang/ast/unittest/emit/ReturnTest.class.php b/src/test/php/lang/ast/unittest/emit/ReturnTest.class.php index d15ddf3b..6b1ed68b 100755 --- a/src/test/php/lang/ast/unittest/emit/ReturnTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/ReturnTest.class.php @@ -1,6 +1,6 @@ emit('$greeting= hello() world()'); } - #[Test, Expect(class: Errors::class, withMessage: 'Unexpected :')] + #[Test, Expect(class: Errors::class, message: '/Unexpected :/')] public function unexpected_colon() { $this->emit('$greeting= hello();:'); } - #[Test, Expect(class: IllegalStateException::class, withMessage: 'Unexpected operator = at line 1')] + #[Test, Expect(class: IllegalStateException::class, message: '/Unexpected operator =/')] public function operator() { $this->emit('=;'); } -} +} \ No newline at end of file diff --git a/src/test/php/lang/ast/unittest/emit/TernaryTest.class.php b/src/test/php/lang/ast/unittest/emit/TernaryTest.class.php index 7bffb2a7..b397dd06 100755 --- a/src/test/php/lang/ast/unittest/emit/TernaryTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/TernaryTest.class.php @@ -1,7 +1,7 @@ getMethod('noLongerSpinning')->invoke($instance)); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.2.0-dev")')] + #[Test, Runtime(php: '>=8.2.0-dev')] public function can_have_constants() { $t= $this->type('trait { const FIXTURE = 1; }'); Assert::equals(1, $t->getConstant('FIXTURE')); diff --git a/src/test/php/lang/ast/unittest/emit/TransformationsTest.class.php b/src/test/php/lang/ast/unittest/emit/TransformationsTest.class.php index a55e33df..8dc2f47f 100755 --- a/src/test/php/lang/ast/unittest/emit/TransformationsTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/TransformationsTest.class.php @@ -3,7 +3,7 @@ use lang\ast\Code; use lang\ast\nodes\{Method, Signature}; use lang\ast\types\IsLiteral; -use unittest\{Assert, Before, Test, Values}; +use test\{Assert, Before, Test, Values}; class TransformationsTest extends EmittingTest { diff --git a/src/test/php/lang/ast/unittest/emit/TypeDeclarationTest.class.php b/src/test/php/lang/ast/unittest/emit/TypeDeclarationTest.class.php index 508167cb..b88813ac 100755 --- a/src/test/php/lang/ast/unittest/emit/TypeDeclarationTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/TypeDeclarationTest.class.php @@ -2,7 +2,7 @@ use lang\XPClass; use lang\reflect\Modifiers; -use unittest\{Assert, Test, Values}; +use test\{Assert, Test, Values}; class TypeDeclarationTest extends EmittingTest { diff --git a/src/test/php/lang/ast/unittest/emit/UnicodeEscapesTest.class.php b/src/test/php/lang/ast/unittest/emit/UnicodeEscapesTest.class.php index d0c21758..2ade1e33 100755 --- a/src/test/php/lang/ast/unittest/emit/UnicodeEscapesTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/UnicodeEscapesTest.class.php @@ -1,6 +1,6 @@ =8.0.0-dev")')] + #[Test, Runtime(php: '>=8.0.0-dev')] public function nullable_union_type_restriction() { $t= $this->type('class { public function test(): int|string|null { } @@ -83,7 +83,7 @@ public function test(): int|string|null { } ); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.0.0-dev")')] + #[Test, Runtime(php: '>=8.0.0-dev')] public function parameter_type_restriction_with_php8() { $t= $this->type('class { public function test(int|string|array $arg) { } @@ -95,7 +95,7 @@ public function test(int|string|array $arg) { } ); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.0.0-dev")')] + #[Test, Runtime(php: '>=8.0.0-dev')] public function parameter_function_type_restriction_with_php8() { $t= $this->type('class { public function test(): string|(function(): string) { } @@ -107,7 +107,7 @@ public function test(): string|(function(): string) { } ); } - #[Test, Action(eval: 'new RuntimeVersion(">=8.0.0-dev")')] + #[Test, Runtime(php: '>=8.0.0-dev')] public function return_type_restriction_with_php8() { $t= $this->type('class { public function test(): int|string|array { } diff --git a/src/test/php/lang/ast/unittest/emit/UsingTest.class.php b/src/test/php/lang/ast/unittest/emit/UsingTest.class.php index 0dc7e0d5..fd382d29 100755 --- a/src/test/php/lang/ast/unittest/emit/UsingTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/UsingTest.class.php @@ -1,6 +1,6 @@ getField('value')->getModifiers()); } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access private property .+::\\$value/')] + #[Test, Expect(class: Error::class, message: '/Cannot access private property .+::\\$value/')] public function cannot_read_private_field() { $t= $this->type('class { private int $value; @@ -36,7 +36,7 @@ public function cannot_read_private_field() { $t->newInstance()->value; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access private property .+::\\$value/')] + #[Test, Expect(class: Error::class, message: '/Cannot access private property .+::\\$value/')] public function cannot_write_private_field() { $t= $this->type('class { private int $value; @@ -45,7 +45,7 @@ public function cannot_write_private_field() { $t->newInstance()->value= 6100; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access protected property .+::\\$value/')] + #[Test, Expect(class: Error::class, message: '/Cannot access protected property .+::\\$value/')] public function cannot_read_protected_field() { $t= $this->type('class { protected int $value; @@ -54,7 +54,7 @@ public function cannot_read_protected_field() { $t->newInstance()->value; } - #[Test, Expect(class: Error::class, withMessage: '/Cannot access protected property .+::\\$value/')] + #[Test, Expect(class: Error::class, message: '/Cannot access protected property .+::\\$value/')] public function cannot_write_protected_field() { $t= $this->type('class { protected int $value; @@ -87,7 +87,7 @@ public function initial_value_available_via_reflection() { Assert::equals(6100, $t->getField('value')->setAccessible(true)->get($t->newInstance())); } - #[Test, Values([[null], ['Test'], [[]]]), Expect(class: Error::class, withMessage: '/property .+::\$value of type int/')] + #[Test, Values([[null], ['Test'], [[]]]), Expect(class: Error::class, message: '/property .+::\$value of type int/')] public function type_checked_at_runtime($in) { $this->run('class { private int $value; diff --git a/src/test/php/lang/ast/unittest/emit/YieldTest.class.php b/src/test/php/lang/ast/unittest/emit/YieldTest.class.php index 1ba186aa..6214402c 100755 --- a/src/test/php/lang/ast/unittest/emit/YieldTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/YieldTest.class.php @@ -1,6 +1,6 @@ getSimpleName()); } - #[Test, Expect(class: ClassFormatException::class, withMessage: 'Compiler error: Expected "type name", have "(end)"')] + #[Test, Expect(class: ClassFormatException::class, message: '/Compiler error: Expected "type name", have .+/')] public function load_class_with_syntax_errors() { $this->compile(['Errors' => "loadClass($types['Errors']); }); } - #[Test, Action(eval: 'new RuntimeVersion(">=7.3")'), Expect(class: ClassFormatException::class, withMessage: '/Compiler error: Class .+ not found/')] + #[Test, Runtime(php: '>=7.3'), Expect(class: ClassFormatException::class, message: '/Compiler error: Class .+ not found/')] public function load_class_with_non_existant_parent() { $code= "compile(['Orphan' => $code], function($loader, $types) {