1 | <?php |
||
11 | class Config |
||
12 | { |
||
13 | const EXTENSION_CONFIG_KEY = 'screenshot'; |
||
14 | const CONFIG_CONTAINER_ID = 'bex.screenshot_extension.config'; |
||
15 | |||
16 | const IMAGE_DRIVER_NAMESPACE = 'Bex\\Behat\\ScreenshotExtension\\Driver'; |
||
17 | const IMAGE_DRIVER_PARENT = 'Bex\\Behat\\ScreenshotExtension\\Driver\\ImageDriverInterface'; |
||
18 | |||
19 | const CONFIG_PARAM_EXTENSTION_ENABLED = 'enabled'; |
||
20 | const CONFIG_PARAM_ACTIVE_IMAGE_DRIVERS = 'active_image_drivers'; |
||
21 | const CONFIG_PARAM_IMAGE_DRIVER_CONFIGS = 'image_drivers'; |
||
22 | const CONFIG_PARAM_SCREENSHOT_TAKING_MODE = 'screenshot_taking_mode'; |
||
23 | const CONFIG_PARAM_SCREENSHOT_FILENAME_PATTERN = 'screenshot_filename_pattern'; |
||
24 | |||
25 | const SCREENSHOT_TAKING_MODE_FAILED_STEPS = 'failed_steps'; |
||
26 | const SCREENSHOT_TAKING_MODE_FAILED_SCENARIOS = 'failed_scenarios'; |
||
27 | const SCREENSHOT_TAKING_MODE_ALL_SCENARIOS = 'all_scenarios'; |
||
28 | |||
29 | const DEFAULT_IMAGE_DRIVER_KEY = 'local'; |
||
30 | const DEFAULT_SCREENSHOT_TAKING_MODE = self::SCREENSHOT_TAKING_MODE_FAILED_STEPS; |
||
31 | |||
32 | const DEFAULT_SCREENSHOT_FILENAME_PATTERN = '%FEATURE_FILE_PATH%_%SCENARIO_LINE_NUMBER%'; |
||
33 | |||
34 | const ERROR_MESSAGE_IMAGICK_NOT_FOUND = 'Imagemagick PHP extension is required, but not installed.'; |
||
35 | |||
36 | /** |
||
37 | * @var DriverLocator |
||
38 | */ |
||
39 | private $driverLocator; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | private $imageDrivers; |
||
45 | |||
46 | /** |
||
47 | * @var boolean |
||
48 | */ |
||
49 | private $enabled; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | */ |
||
54 | private $screenshotTakingMode; |
||
55 | |||
56 | /** |
||
57 | * @var string[] |
||
58 | */ |
||
59 | private $imageDriverKeys; |
||
60 | |||
61 | /** |
||
62 | * @var array |
||
63 | */ |
||
64 | private $imageDriverConfigs; |
||
65 | |||
66 | /** |
||
67 | * @var string |
||
68 | */ |
||
69 | private $screenshotFilenamePattern; |
||
70 | |||
71 | /** |
||
72 | * @param array $config |
||
73 | */ |
||
74 | public function __construct(array $config) |
||
83 | |||
84 | /** |
||
85 | * @return boolean |
||
86 | */ |
||
87 | public function isEnabled() |
||
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | public function getImageDrivers() |
||
99 | |||
100 | /** |
||
101 | * @return boolean |
||
102 | */ |
||
103 | public function shouldCombineImages() |
||
107 | |||
108 | /** |
||
109 | * @return boolean |
||
110 | */ |
||
111 | public function shouldRecordAllScenarios() |
||
115 | |||
116 | /** |
||
117 | * @return boolean |
||
118 | */ |
||
119 | public function shouldRecordAllSteps() |
||
123 | |||
124 | /** |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getScreenshotFilenamePattern() |
||
131 | |||
132 | /** |
||
133 | * Init service container and load image drivers |
||
134 | * |
||
135 | * @param ContainerBuilder $container |
||
136 | */ |
||
137 | public function loadServices(ContainerBuilder $container) |
||
147 | |||
148 | /** |
||
149 | * @return string[] |
||
150 | */ |
||
151 | public static function getScreenshotTakingModes() |
||
159 | |||
160 | /** |
||
161 | * @return \Closure |
||
162 | */ |
||
163 | public static function getScreenshotTakingModeValidator() |
||
169 | } |
||
170 |