Passed
Push — master ( ff8f2e...aaaf39 )
by Aimeos
02:27
created

TestHelper::context()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
/**
5
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
6
 * @copyright Metaways Infosystems GmbH, 2011
7
 * @copyright Aimeos (aimeos.org), 2015-2022
8
 */
9
class TestHelper
10
{
11
	private static $aimeos;
12
13
14
	public static function bootstrap()
15
	{
16
		$aimeos = self::getAimeos();
17
18
		$includepaths = $aimeos->getIncludePaths();
19
		$includepaths[] = get_include_path();
20
		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
	}
22
23
24
	private static function getAimeos()
25
	{
26
		if( !isset( self::$aimeos ) )
27
		{
28
			require_once 'Bootstrap.php';
29
			spl_autoload_register( '\Aimeos\Bootstrap::autoload' );
30
31
			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
32
			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
33
		}
34
35
		return self::$aimeos;
36
	}
37
}
38