1 | <?php |
||
16 | class DrupalDriverManager { |
||
17 | |||
18 | /** |
||
19 | * The name of the default driver. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | private $defaultDriverName; |
||
24 | |||
25 | /** |
||
26 | * All registered drivers. |
||
27 | * |
||
28 | * @var \Drupal\Driver\DriverInterface[] |
||
29 | */ |
||
30 | private $drivers = array(); |
||
31 | |||
32 | /** |
||
33 | * Behat environment. |
||
34 | * |
||
35 | * @var \Behat\Testwork\Environment\Environment |
||
36 | */ |
||
37 | private $environment; |
||
38 | |||
39 | /** |
||
40 | * Initialize the driver manager. |
||
41 | * |
||
42 | * @param \Drupal\Driver\DriverInterface[] $drivers |
||
43 | * An array of drivers to register. |
||
44 | */ |
||
45 | public function __construct(array $drivers = array()) { |
||
50 | |||
51 | /** |
||
52 | * Register a new driver. |
||
53 | * |
||
54 | * @param string $name |
||
55 | * Driver name. |
||
56 | * @param \Drupal\Driver\DriverInterface $driver |
||
57 | * An instance of a DriverInterface. |
||
58 | */ |
||
59 | public function registerDriver($name, DriverInterface $driver) { |
||
63 | |||
64 | /** |
||
65 | * Return a registered driver by name, or the default driver. |
||
66 | * |
||
67 | * @param string $name |
||
68 | * The name of the driver to return. If omitted the default driver is |
||
69 | * returned. |
||
70 | * |
||
71 | * @return \Drupal\Driver\DriverInterface |
||
72 | * The requested driver. |
||
73 | * |
||
74 | * @throws \InvalidArgumentException |
||
75 | * Thrown when the requested driver is not registered. |
||
76 | */ |
||
77 | public function getDriver($name = NULL) { |
||
97 | |||
98 | /** |
||
99 | * Set the default driver name. |
||
100 | * |
||
101 | * @param string $name |
||
102 | * Default driver name to set. |
||
103 | * |
||
104 | * @throws \InvalidArgumentException |
||
105 | * Thrown when the driver is not registered. |
||
106 | */ |
||
107 | public function setDefaultDriverName($name) { |
||
116 | |||
117 | /** |
||
118 | * Returns all registered drivers. |
||
119 | * |
||
120 | * @return \Drupal\Driver\DriverInterface[] |
||
121 | * An array of drivers. |
||
122 | */ |
||
123 | public function getDrivers() { |
||
126 | |||
127 | /** |
||
128 | * Sets the Behat Environment. |
||
129 | * |
||
130 | * @param \Behat\Testwork\Environment\Environment $environment |
||
131 | * The Behat Environment to set. |
||
132 | */ |
||
133 | public function setEnvironment(Environment $environment) { |
||
136 | |||
137 | /** |
||
138 | * Returns the Behat Environment. |
||
139 | * |
||
140 | * @return \Behat\Testwork\Environment\Environment |
||
141 | * The Behat Environment. |
||
142 | */ |
||
143 | public function getEnvironment() { |
||
146 | |||
147 | } |
||
148 |