TestCase   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 46
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createApplication() 0 7 1
A seedDatabase() 0 5 1
1
<?php
2
3
class TestCase extends Illuminate\Foundation\Testing\TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	public $dbSeeded = false;
6
	
7
	/**
8
	 * Creates the application.
9
	 *
10
	 * @return \Symfony\Component\HttpKernel\HttpKernelInterface
11
	 */
12 9
	public function createApplication() {
13 9
		$unitTesting = true;
14
15 9
		$testEnvironment = 'testing';
16
17 9
		return require __DIR__ . '/../../bootstrap/start.php';
18
	}
19
20 9
	public function seedDatabase() {
21 9
		$this->app['artisan']->call('migrate');
22 9
		$this->app['artisan']->call('db:seed');
23 9
		$this->dbSeeded = true;
24 9
	}
25
26
27
	/**
28
	 * Start database transaction to speed up the tests related to database
29
	 */
30 9
	public function setUp() {
31 9
		parent::setUp();
32
33 9
		if (! $this->dbSeeded) {
34 9
			$this->seedDatabase();
35 9
		}
36
37 9
		DB::beginTransaction();
38 9
	}
39
40
	/**
41
	 * After test roll back all done stuff
42
	 */
43 9
	public function tearDown() {
44 9
		parent::tearDown();
45
46 9
		DB::rollBack();
47 9
	}
48
}
49