Passed
Pull Request — master (#23)
by Peter
06:51 queued 04:09
created

TestCase::createApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
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
     *
37
     * @param  string  $className
38
     * @param  string  $propertyName
39
     * @return \ReflectionProperty
40
     */
41
    public function getPrivateProperty($className, $propertyName)
42
    {
43
        $reflector = new ReflectionClass($className);
44
        $property = $reflector->getProperty($propertyName);
45
        $property->setAccessible(true);
46
47
        return $property;
48
    }
49
}
50