Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmejias committed Jan 1, 2022
1 parent bbad7bc commit 914c908
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Veils/FooVeil.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @method static string getVeilAccessor() Get veil accessor.
* @method static \AdrianMejias\Tests\Veils\MyTestClass getVeilInstance()
* Get veil instance.
* @method static string bar() Say hi.
* @method static string bar(mixed ...$args) Say hi.
*/
class FooVeil extends VeilAbstract
{
Expand Down
13 changes: 12 additions & 1 deletion tests/Veils/MyTestClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@

namespace AdrianMejias\Tests\Veils;

/**
* My Test Class.
*
* @package Veil
* @category Test
*/
class MyTestClass
{
/**
* Say hi.
*
* @param mixed $args
* @return string
*/
public function bar(): string
public function bar(...$args): string
{
if (count($args) > 0) {
return 'hi' . json_encode($args ?? []);
}

return 'hi';
}
}
75 changes: 75 additions & 0 deletions tests/VeilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,81 @@ public function it_can_call_method()
$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
* @covers \AdrianMejias\Veil\VeilAbstract
*/
public function it_can_call_method_with_one_arg()
{
(new Veil)->register()->add('Foo', FooVeil::class);

$expected = \Foo::bar(1);
$actual = FooVeil::getVeilInstance()->bar(1);

$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
* @covers \AdrianMejias\Veil\VeilAbstract
*/
public function it_can_call_method_with_two_args()
{
(new Veil)->register()->add('Foo', FooVeil::class);

$expected = \Foo::bar(1, 2);
$actual = FooVeil::getVeilInstance()->bar(1, 2);

$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
* @covers \AdrianMejias\Veil\VeilAbstract
*/
public function it_can_call_method_with_three_args()
{
(new Veil)->register()->add('Foo', FooVeil::class);

$expected = \Foo::bar(1, 2, 3);
$actual = FooVeil::getVeilInstance()->bar(1, 2, 3);

$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
* @covers \AdrianMejias\Veil\VeilAbstract
*/
public function it_can_call_method_with_four_args()
{
(new Veil)->register()->add('Foo', FooVeil::class);

$expected = \Foo::bar(1, 2, 3, 4);
$actual = FooVeil::getVeilInstance()->bar(1, 2, 3, 4);

$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
* @covers \AdrianMejias\Veil\VeilAbstract
*/
public function it_can_call_method_with_five_args()
{
(new Veil)->register()->add('Foo', FooVeil::class);

$expected = \Foo::bar(1, 2, 3, 4, 5);
$actual = FooVeil::getVeilInstance()->bar(1, 2, 3, 4, 5);

$this->assertSame($expected, $actual);
}

/**
* @test
* @covers \AdrianMejias\Veil\Veil
Expand Down

0 comments on commit 914c908

Please sign in to comment.