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 | |||
24 | const SCREENSHOT_TAKING_MODE_FAILED_STEPS = 'failed_steps'; |
||
25 | const SCREENSHOT_TAKING_MODE_FAILED_SCENARIOS = 'failed_scenarios'; |
||
26 | const SCREENSHOT_TAKING_MODE_ALL_SCENARIOS = 'all_scenarios'; |
||
27 | |||
28 | const DEFAULT_IMAGE_DRIVER_KEY = 'local'; |
||
29 | const DEFAULT_SCREENSHOT_TAKING_MODE = self::SCREENSHOT_TAKING_MODE_FAILED_STEPS; |
||
30 | |||
31 | const ERROR_MESSAGE_IMAGICK_NOT_FOUND = 'Imagemagick PHP extension is required, but not installed.'; |
||
32 | |||
33 | /** |
||
34 | * @var DriverLocator |
||
35 | */ |
||
36 | private $driverLocator; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $imageDrivers; |
||
42 | |||
43 | /** |
||
44 | * @var boolean |
||
45 | */ |
||
46 | private $enabled; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $screenshotTakingMode; |
||
52 | |||
53 | /** |
||
54 | * @var string[] |
||
55 | */ |
||
56 | private $imageDriverKeys; |
||
57 | |||
58 | /** |
||
59 | * @var array |
||
60 | */ |
||
61 | private $imageDriverConfigs; |
||
62 | |||
63 | /** |
||
64 | * @param array $config |
||
65 | */ |
||
66 | public function __construct(array $config) |
||
74 | |||
75 | /** |
||
76 | * @return boolean |
||
77 | */ |
||
78 | public function isEnabled() |
||
82 | |||
83 | /** |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getImageDrivers() |
||
90 | |||
91 | /** |
||
92 | * @return boolean |
||
93 | */ |
||
94 | public function shouldCombineImages() |
||
98 | |||
99 | /** |
||
100 | * @return boolean |
||
101 | */ |
||
102 | public function shouldRecordAllScenarios() |
||
106 | |||
107 | /** |
||
108 | * @return boolean |
||
109 | */ |
||
110 | public function shouldRecordAllSteps() |
||
114 | |||
115 | /** |
||
116 | * Init service container and load image drivers |
||
117 | * |
||
118 | * @param ContainerBuilder $container |
||
119 | */ |
||
120 | public function loadServices(ContainerBuilder $container) |
||
130 | |||
131 | /** |
||
132 | * @return string[] |
||
133 | */ |
||
134 | public static function getScreenshotTakingModes() |
||
142 | |||
143 | /** |
||
144 | * @return \Closure |
||
145 | */ |
||
146 | public static function getScreenshotTakingModeValidator() |
||
152 | } |
||
153 |