1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Drupal\Driver; |
4
|
|
|
|
5
|
|
|
use Drupal\Driver\Exception\UnsupportedDriverActionException; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Implements DriverInterface. |
9
|
|
|
*/ |
10
|
|
|
abstract class BaseDriver implements DriverInterface { |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* {@inheritdoc} |
14
|
|
|
*/ |
15
|
|
|
public function getRandom() { |
16
|
|
|
throw new UnsupportedDriverActionException($this->errorString('generate random'), $this); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
*/ |
22
|
|
|
public function bootstrap() { |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
public function isBootstrapped() { |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* {@inheritdoc} |
33
|
|
|
*/ |
34
|
|
|
public function userAlter($user, $values) { |
35
|
|
|
throw new UnsupportedDriverActionException($this->errorString('alter users'), $this); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@inheritdoc} |
40
|
|
|
*/ |
41
|
|
|
public function userCreate(\stdClass $user) { |
42
|
|
|
throw new UnsupportedDriverActionException($this->errorString('create users'), $this); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
*/ |
48
|
|
|
public function userDelete(\stdClass $user) { |
49
|
|
|
throw new UnsupportedDriverActionException($this->errorString('delete users'), $this); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* {@inheritdoc} |
54
|
|
|
*/ |
55
|
|
|
public function processBatch() { |
56
|
|
|
throw new UnsupportedDriverActionException($this->errorString('process batch actions'), $this); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* {@inheritdoc} |
61
|
|
|
*/ |
62
|
|
|
public function userAddRole(\stdClass $user, $role) { |
63
|
|
|
throw new UnsupportedDriverActionException($this->errorString('add roles'), $this); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* {@inheritdoc} |
68
|
|
|
*/ |
69
|
|
|
public function fetchWatchdog($count = 10, $type = NULL, $severity = NULL) { |
70
|
|
|
throw new UnsupportedDriverActionException($this->errorString('access watchdog entries'), $this); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* {@inheritdoc} |
75
|
|
|
*/ |
76
|
|
|
public function clearCache($type = NULL) { |
77
|
|
|
throw new UnsupportedDriverActionException($this->errorString('clear Drupal caches'), $this); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
|
|
public function clearStaticCaches() { |
84
|
|
|
throw new UnsupportedDriverActionException($this->errorString('clear static caches'), $this); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* {@inheritdoc} |
89
|
|
|
*/ |
90
|
|
|
public function nodeAlter($node, $values) { |
91
|
|
|
throw new UnsupportedDriverActionException($this->errorString('alter nodes'), $this); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* {@inheritdoc} |
96
|
|
|
*/ |
97
|
|
|
public function createNode($node) { |
98
|
|
|
throw new UnsupportedDriverActionException($this->errorString('create nodes'), $this); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* {@inheritdoc} |
103
|
|
|
*/ |
104
|
|
|
public function nodeDelete($node) { |
105
|
|
|
throw new UnsupportedDriverActionException($this->errorString('delete nodes'), $this); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* {@inheritdoc} |
110
|
|
|
*/ |
111
|
|
|
public function runCron() { |
112
|
|
|
throw new UnsupportedDriverActionException($this->errorString('run cron'), $this); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* {@inheritdoc} |
117
|
|
|
*/ |
118
|
|
|
public function createTerm(\stdClass $term) { |
119
|
|
|
throw new UnsupportedDriverActionException($this->errorString('create terms'), $this); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* {@inheritdoc} |
124
|
|
|
*/ |
125
|
|
|
public function termDelete(\stdClass $term) { |
126
|
|
|
throw new UnsupportedDriverActionException($this->errorString('delete terms'), $this); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* {@inheritdoc} |
131
|
|
|
*/ |
132
|
|
|
public function roleCreate(array $permissions) { |
133
|
|
|
throw new UnsupportedDriverActionException($this->errorString('create roles'), $this); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* {@inheritdoc} |
138
|
|
|
*/ |
139
|
|
|
public function roleDelete($rid) { |
140
|
|
|
throw new UnsupportedDriverActionException($this->errorString('delete roles'), $this); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* {@inheritdoc} |
145
|
|
|
*/ |
146
|
|
|
public function isField($entity_type, $field_name) { |
147
|
|
|
return FALSE; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* {@inheritdoc} |
152
|
|
|
*/ |
153
|
|
|
public function configGet($name, $key) { |
154
|
|
|
throw new UnsupportedDriverActionException($this->errorString('config get'), $this); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* {@inheritdoc} |
159
|
|
|
*/ |
160
|
|
|
public function configSet($name, $key, $value) { |
161
|
|
|
throw new UnsupportedDriverActionException($this->errorString('config set'), $this); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Error printing exception. |
166
|
|
|
* |
167
|
|
|
* @param string $error |
168
|
|
|
* The term, node, user or permission. |
169
|
|
|
* |
170
|
|
|
* @return string |
171
|
|
|
* A formatted string reminding people to use an API driver. |
172
|
|
|
*/ |
173
|
|
|
private function errorString($error) { |
174
|
|
|
return sprintf('No ability to %s in %%s. Put `@api` into your feature and add an API driver (ex: `api_driver: drupal`) in behat.yml.', $error); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
} |
178
|
|
|
|