TestCase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 40
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createApplication() 0 9 1
A getPrivateProperty() 0 7 1
1
<?php
2
3
namespace Pixelpeter\Genderize;
4
5
use ReflectionClass;
6
7
abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase
8
{
9
    /**
10
     * The base URL to use while testing the application.
11
     *
12
     * @var string
13
     */
14
    protected $baseUrl = 'http://localhost';
15
16
    /**
17
     * Creates the application.
18
     *
19
     * @return \Illuminate\Foundation\Application
20
     */
21
    public function createApplication()
22
    {
23
        $app = require __DIR__ . '/../vendor/laravel/laravel/bootstrap/app.php';
24
25
        $app->register(\Pixelpeter\Genderize\GenderizeServiceProvider::class);
26
27
        $app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
28
29
        return $app;
30
    }
31
32
    /**
33
     * getPrivateProperty
34
     *
35
     * @author    Joe Sexton <[email protected]>
36
     * @param    string $className
37
     * @param    string $propertyName
38
     * @return    \ReflectionProperty
39
     */
40
    public function getPrivateProperty($className, $propertyName)
41
    {
42
        $reflector = new ReflectionClass($className);
43
        $property = $reflector->getProperty($propertyName);
44
        $property->setAccessible(true);
45
46
        return $property;
47
    }
48
}
49