AimeosTestAbstract::getEnvironmentSetUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 65
Code Lines 53

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
cc 1
eloc 53
c 6
b 0
f 0
nc 1
nop 1
dl 0
loc 65
rs 9.0254

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
abstract class AimeosTestAbstract extends Orchestra\Testbench\BrowserKit\TestCase
4
{
5
	protected function getEnvironmentSetUp( $app )
6
	{
7
		putenv( 'APP_DEBUG=1' );
8
9
		$app['config']->set( 'app.key', 'SomeRandomStringWith32Characters' );
10
		$app['config']->set( 'app.cipher', 'AES-256-CBC' );
11
12
		$app['config']->set( 'database.default', 'mysql' );
13
		$app['config']->set( 'database.connections.mysql', [
14
			'driver' => 'mysql',
15
			'host' => env( 'DB_HOST', '127.0.0.1' ),
16
			'port' => env( 'DB_PORT', '3306' ),
17
			'database' => env( 'DB_DATABASE', 'laravel' ),
18
			'username' => env( 'DB_USERNAME', 'aimeos' ),
19
			'password' => env( 'DB_PASSWORD', 'aimeos' ),
20
			'unix_socket' => env( 'DB_SOCKET', '' ),
21
			'collation' => 'utf8_unicode_ci',
22
		] );
23
24
		$app['config']->set( 'shop.resource.db', [
25
			'adapter' => 'mysql',
26
			'host' => env( 'DB_HOST', '127.0.0.1' ),
27
			'database' => env( 'DB_DATABASE', 'laravel' ),
28
			'username' => env( 'DB_USERNAME', 'aimeos' ),
29
			'password' => env( 'DB_PASSWORD', 'aimeos' ),
30
			'stmt' => ["SET SESSION sort_buffer_size=2097144; SET SESSION sql_mode='ANSI'; SET NAMES 'utf8'"],
31
			'opt-persistent' => 0,
32
			'limit' => 3,
33
			'defaultTableOptions' => [
34
				'collate' => 'utf8_unicode_ci',
35
				'charset' => 'utf8',
36
			],
37
		] );
38
39
		$app['config']->set( 'shop.resource.fs', [
40
			'adapter' => 'Standard',
41
			'tempdir' => storage_path( 'tmp' ),
42
			'basedir' => storage_path( 'tmp' ),
43
			'baseurl' => '/aimeos',
44
		] );
45
46
		$app['config']->set( 'shop.authorize', false );
47
		$app['config']->set( 'shop.disableSites', false );
48
		$app['config']->set( 'shop.accessControl', false );
49
		$app['config']->set( 'shop.admin.graphql.debug', true );
50
		$app['config']->set( 'shop.routes.jqadm', ['prefix' => '{site}/jqadm'] );
51
		$app['config']->set( 'shop.routes.graphql', ['prefix' => '{site}/graphql'] );
52
		$app['config']->set( 'shop.routes.jsonadm', ['prefix' => '{site}/jsonadm'] );
53
		$app['config']->set( 'shop.routes.jsonapi', ['prefix' => '{site}/jsonapi'] );
54
		$app['config']->set( 'shop.routes.account', ['prefix' => '{site}/profile'] );
55
		$app['config']->set( 'shop.routes.default', ['prefix' => '{site}/shop'] );
56
		$app['config']->set( 'shop.routes.confirm', ['prefix' => '{site}/shop'] );
57
		$app['config']->set( 'shop.routes.update', ['prefix' => '{site}'] );
58
		$app['config']->set( 'shop.routes.page', ['prefix' => '{site}/p'] );
59
		$app['config']->set( 'shop.routes.resolve', ['prefix' => '{site}', 'middleware' => ['web']] );
60
		$app['config']->set( 'shop.routes.login', [] );
61
		$app['config']->set( 'shop.mshop.locale.site', 'unittest' );
62
		$app['config']->set( 'shop.resource.email.from-email', 'root@localhost' );
63
64
		Route::any( 'login', ['as' => 'login'] );
65
		Route::any( 'logout', ['as' => 'logout'] );
66
		Route::match( array( 'GET', 'POST' ), '{site}/resolve/{path?}', array(
67
			'as' => 'aimeos_resolve',
68
			'uses' => 'Aimeos\Shop\Controller\ResolveController@indexAction'
69
		) )->where( ['locale' => '[a-z]{2}(\_[A-Z]{2})?', 'site' => '[A-Za-z0-9\.\-]+', 'path', '.*'] );
70
	}
71
72
73
	protected function getPackageProviders( $app )
74
	{
75
		return ['Aimeos\Shop\ShopServiceProvider'];
76
	}
77
}