From 4afc1ea404ef1227d062c336b7966023068d98d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kucha=C5=99?= <honza.kuchar@grifart.cz> Date: Wed, 26 Apr 2017 20:26:48 +0200 Subject: [PATCH] tests: added parameters test --- .gitignore | 2 ++ tests/{optional.phpt => fn.optional.phpt} | 0 tests/fn.parameters.phpt | 26 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) rename tests/{optional.phpt => fn.optional.phpt} (100%) create mode 100644 tests/fn.parameters.phpt diff --git a/.gitignore b/.gitignore index db94f80..6b2871a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /vendor /.idea /composer.lock +/**/*.actual +/**/*.expected diff --git a/tests/optional.phpt b/tests/fn.optional.phpt similarity index 100% rename from tests/optional.phpt rename to tests/fn.optional.phpt diff --git a/tests/fn.parameters.phpt b/tests/fn.parameters.phpt new file mode 100644 index 0000000..e00071f --- /dev/null +++ b/tests/fn.parameters.phpt @@ -0,0 +1,26 @@ +<?php declare(strict_types=1); +namespace MyTestNamespace; +require __DIR__ . '/bootstrap.php'; + +use function Grifart\AssertFunction\optional; +use function Grifart\AssertFunction\parameters; +use Tester\Assert; + +class TestClass {}; + +Assert::equal(['MyTestNamespace\TestClass'], parameters(TestClass::class)); +Assert::equal([ + 'MyTestNamespace\TestClass', + 'MyTestNamespace\TestClass' +], parameters( + TestClass::class, + TestClass::class +)); + +Assert::equal([ + '?MyTestNamespace\TestClass', + 'MyTestNamespace\TestClass' +], parameters( + optional(TestClass::class), + TestClass::class +)); -- GitLab