TestCase   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
eloc 23
c 3
b 0
f 0
dl 0
loc 47
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getEnvironmentSetUp() 0 4 1
A setUp() 0 3 1
A getPackageProviders() 0 4 1
A defineDatabaseMigrations() 0 4 1
A defineRoutes() 0 20 1
1
<?php
2
3
namespace Ikechukwukalu\Requirepin\Tests;
4
5
use Ikechukwukalu\Requirepin\RequirePinServiceProvider;
6
use Ikechukwukalu\Requirepin\Controllers\PinController;
7
use Ikechukwukalu\Requirepin\Tests\Controllers\BookController;
8
use Illuminate\Foundation\Testing\RefreshDatabase;
9
use Orchestra\Testbench\TestCase as BaseTestCase;
10
use Stevebauman\Location\LocationServiceProvider;
11
12
abstract class TestCase extends BaseTestCase
13
{
14
    use RefreshDatabase;
0 ignored issues
show
introduced by
The trait Illuminate\Foundation\Testing\RefreshDatabase requires some properties which are not provided by Ikechukwukalu\Requirepin\Tests\TestCase: $seeder, $seed, $connectionsToTransact, $dropTypes, $dropViews
Loading history...
15
16
    public function setUp(): void
17
    {
18
      parent::setUp();
19
    }
20
21
    protected function defineDatabaseMigrations()
22
    {
23
        $this->loadLaravelMigrations();
24
        $this->loadMigrationsFrom(__DIR__.'/migrations');
25
    }
26
27
    protected function defineRoutes($router)
28
    {
29
        // Define routes.
30
        $router->get('login', function () {
31
            return 'login';
32
        })->name('login');
33
34
        $router->post('test/v1/sample/books', [BookController::class, 'createBook'])
35
            ->name('createBookTest')
36
            ->middleware('require.pin');
37
38
        $router->delete('test/v1/sample/books/{id}', [BookController::class, 'deleteBook'])
39
            ->name('deleteBookTest')
40
            ->middleware('require.pin');
41
42
        $router->post('/test/change/pin', [PinController::class, 'changePin'])
43
            ->name('changePin');
44
45
        $router->post('/test/pin/required/{uuid}', [PinController::class,
46
            'pinRequired'])->name('pinRequired');
47
    }
48
49
    protected function getPackageProviders($app): array
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

49
    protected function getPackageProviders(/** @scrutinizer ignore-unused */ $app): array

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        return [RequirePinServiceProvider::class,
52
                LocationServiceProvider::class];
53
    }
54
55
    protected function getEnvironmentSetUp($app) {
56
        $app['config']->set('auth.guards.sanctum', [
57
                        'driver' => 'session',
58
                        'provider' => 'users',
59
                    ]);
60
    }
61
}
62