1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Axstrad Library. |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2015 Dan Kempster |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* Feel free to edit as you please, and have fun. |
11
|
|
|
* |
12
|
|
|
* @author Dan Kempster <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Axstrad\Bundle\UseCaseTestBundle\Test; |
16
|
|
|
|
17
|
|
|
use Axstrad\Bundle\UseCaseTestBundle\Exception\PathDoesNotExistException; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Axstrad\Bundle\UseCaseTestBundle\Test\MultiUseCaseTest |
21
|
|
|
*/ |
22
|
|
|
abstract class MultiUseCaseTest extends UseCaseTest |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var string The path to the use cases relative to the project's root. |
26
|
|
|
*/ |
27
|
|
|
public static $useCasesDir = 'Tests/UseCases'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Returns the absolure path to the UseCases. |
31
|
|
|
* |
32
|
|
|
* Appends the {@see useCaseDir use case directory} to the root of your |
33
|
|
|
* project. The project root is detected based on the {@see getPhpUnitXmlDir |
34
|
|
|
* location of PHPUnit's configuration file}. |
35
|
|
|
* |
36
|
|
|
* @return string |
37
|
|
|
* @throws InvalidPathException |
38
|
|
|
*/ |
39
|
10 |
|
public static function getAbsoluteUseCasesDir() |
40
|
|
|
{ |
41
|
10 |
|
$path = static::getPhpUnitXmlDir() . |
42
|
10 |
|
DIRECTORY_SEPARATOR . |
43
|
|
|
static::$useCasesDir |
44
|
10 |
|
; |
45
|
|
|
|
46
|
10 |
|
if (!is_dir($path)) { |
47
|
1 |
|
throw new PathDoesNotExistException( |
48
|
1 |
|
sprintf( |
49
|
|
|
"The path '%s' doesn't exist.". |
50
|
1 |
|
" Which was generated from your project root (%s) and the". |
51
|
1 |
|
" defined use case directory (%s). See". |
52
|
1 |
|
" Axstrad\Bundle\UseCaseTestBundle\Test\UseCaseTest::\$useCasesDir", |
53
|
1 |
|
$path, |
54
|
1 |
|
static::getPhpUnitXmlDir(), |
55
|
|
|
static::$useCasesDir |
56
|
1 |
|
) |
57
|
1 |
|
); |
58
|
|
|
} |
59
|
|
|
|
60
|
9 |
|
return $path; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|