Skip to content

Commit 69cd5b0

Browse files
committed
Test attribtute
1 parent 64a26de commit 69cd5b0

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

tests/Actions/FooAction.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Test\Actions;
4+
5+
6+
class FooAction
7+
{
8+
9+
}

tests/Actions/TestAction.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Test\Actions;
4+
5+
use Ruta\Attributes\Route;
6+
7+
#[Route('GET', '/test')]
8+
class TestAction
9+
{
10+
11+
}

tests/AttributeTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use Ruta\Router;
4+
5+
it('finds routes from attributes', function() {
6+
$router = new Router;
7+
$router->loadFromAttributes(__DIR__ . '/Actions', 'Test\Actions');
8+
9+
expect($router)->toBeInstanceOf(Router::class);
10+
});
11+
12+
it('no classes in folder from attributes', function() {
13+
$router = new Router;
14+
$router->loadFromAttributes(__DIR__, 'Test\Actions');
15+
16+
expect($router)->toBeInstanceOf(Router::class);
17+
});

0 commit comments

Comments
 (0)