@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | /** |
262 | 262 | * {@inheritDoc} |
263 | - * @return bool|PDOStatement |
|
263 | + * @return PDOStatement |
|
264 | 264 | */ |
265 | 265 | public function query($sql) |
266 | 266 | { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
426 | - * @param $name |
|
426 | + * @param string $name |
|
427 | 427 | * @return bool |
428 | 428 | */ |
429 | 429 | public function hasConnectionName($name) |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php namespace AgelxNash\Modx\Evo\Database\Drivers; |
2 | 2 | |
3 | 3 | use AgelxNash\Modx\Evo\Database\Exceptions; |
4 | +use Illuminate\Container\Container; |
|
5 | +use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; |
|
4 | 6 | use Illuminate\Database\Capsule\Manager as Capsule; |
5 | 7 | use Illuminate\Database\Connection; |
6 | -use PDOStatement; |
|
7 | 8 | use Illuminate\Events\Dispatcher; |
8 | -use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; |
|
9 | -use Illuminate\Container\Container; |
|
10 | -use ReflectionClass; |
|
11 | 9 | use PDO; |
10 | +use PDOStatement; |
|
11 | +use ReflectionClass; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @property Connection $conn |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getConnect() |
116 | 116 | { |
117 | - if (! $this->isConnected()) { |
|
117 | + if (!$this->isConnected()) { |
|
118 | 118 | $this->connect(); |
119 | - if (! $this->conn->getPdo() instanceof PDO) { |
|
119 | + if (!$this->conn->getPdo() instanceof PDO) { |
|
120 | 120 | $this->conn->reconnect(); |
121 | 121 | } |
122 | 122 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function connect() |
158 | 158 | { |
159 | 159 | try { |
160 | - if (! $this->hasConnectionName($this->connection)) { |
|
160 | + if (!$this->hasConnectionName($this->connection)) { |
|
161 | 161 | $this->getCapsule()->addConnection([ |
162 | 162 | 'driver' => $this->driver, |
163 | 163 | 'host' => $this->getConfig('host'), |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | $method = $this->getConfig('method'); |
232 | 232 | } |
233 | 233 | |
234 | - $query = $method . ' ' . $charset; |
|
234 | + $query = $method.' '.$charset; |
|
235 | 235 | |
236 | - return (bool)$this->query($query); |
|
236 | + return (bool) $this->query($query); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function selectDb($name) |
243 | 243 | { |
244 | - return $this->getConnect()->getPdo()->exec('USE ' . $name) === 0; |
|
244 | + return $this->getConnect()->getPdo()->exec('USE '.$name) === 0; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $result = $this->prepare($sql); |
271 | 271 | $this->execute($result); |
272 | 272 | |
273 | - if ($this->saveAffectedRows($result) === 0 && $this->isResult($result) && ! $this->isSelectQuery($sql)) { |
|
273 | + if ($this->saveAffectedRows($result) === 0 && $this->isResult($result) && !$this->isSelectQuery($sql)) { |
|
274 | 274 | $result = true; |
275 | 275 | } |
276 | 276 | $this->getConnect()->logQuery($sql, [], $this->getElapsedTime($start)); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function execute($result) |
387 | 387 | { |
388 | - return $this->isResult($result) ? $result->execute() : (bool)$result; |
|
388 | + return $this->isResult($result) ? $result->execute() : (bool) $result; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -102,6 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | /** |
104 | 104 | * {@inheritDoc} |
105 | + * @param mysqli_result $result |
|
105 | 106 | */ |
106 | 107 | public function isResult($result) |
107 | 108 | { |
@@ -161,7 +162,7 @@ discard block |
||
161 | 162 | |
162 | 163 | /** |
163 | 164 | * {@inheritDoc} |
164 | - * @return bool|mysqli_result |
|
165 | + * @return mysqli_result |
|
165 | 166 | * @throws \ReflectionException |
166 | 167 | */ |
167 | 168 | public function query($sql) |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php namespace AgelxNash\Modx\Evo\Database\Drivers; |
2 | 2 | |
3 | 3 | use AgelxNash\Modx\Evo\Database\Exceptions; |
4 | +use ReflectionClass; |
|
4 | 5 | use mysqli; |
6 | +use mysqli_driver; |
|
5 | 7 | use mysqli_result; |
6 | 8 | use mysqli_sql_exception; |
7 | -use mysqli_driver; |
|
8 | -use ReflectionClass; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * @property mysqli $conn |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getConnect() |
31 | 31 | { |
32 | - if (! $this->isConnected()) { |
|
32 | + if (!$this->isConnected()) { |
|
33 | 33 | return $this->connect(); |
34 | 34 | } |
35 | 35 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getLastErrorNo() |
59 | 59 | { |
60 | - $out = (string)$this->getConnect()->sqlstate; |
|
60 | + $out = (string) $this->getConnect()->sqlstate; |
|
61 | 61 | |
62 | 62 | if ($out === '00000') { |
63 | 63 | $out = ''; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $method = $this->getConfig('method'); |
139 | 139 | } |
140 | 140 | |
141 | - $this->query($method . ' ' . $charset); |
|
141 | + $this->query($method.' '.$charset); |
|
142 | 142 | |
143 | 143 | return $this->getConnect()->set_charset($charset); |
144 | 144 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @param string $message |
11 | - * @param int|string $code |
|
11 | + * @param integer $code |
|
12 | 12 | * @param Throwable|null $previous |
13 | 13 | */ |
14 | 14 | public function __construct($message = '', $code = 0, Throwable $previous = null) |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function __construct($message = '', $code = 0, Throwable $previous = null) |
15 | 15 | { |
16 | - parent::__construct($message, (int)$code, $previous); |
|
16 | + parent::__construct($message, (int) $code, $previous); |
|
17 | 17 | |
18 | 18 | $this->code = $code; |
19 | 19 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | interface DatabaseInterface extends ProxyInterface |
6 | 6 | { |
7 | 7 | /** |
8 | - * @return mixed |
|
8 | + * @return DriverInterface |
|
9 | 9 | */ |
10 | 10 | public function getDriver(); |
11 | 11 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param string $table |
29 | - * @param string|array $where |
|
29 | + * @param string $where |
|
30 | 30 | * @param string $orderBy |
31 | 31 | * @param string $limit |
32 | 32 | * @return mixed |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @param string|array $fields |
40 | 40 | * @param string|array $tables |
41 | - * @param string|array $where |
|
41 | + * @param string $where |
|
42 | 42 | * @param string $orderBy |
43 | 43 | * @param string $limit |
44 | 44 | * @return mixed |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @param string|array $values |
52 | 52 | * @param string $table |
53 | - * @param string|array $where |
|
53 | + * @param string $where |
|
54 | 54 | * @return mixed |
55 | 55 | * @throws Exceptions\TableNotDefinedException |
56 | 56 | * @throws Exceptions\InvalidFieldException |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @param string|array $fields |
62 | 62 | * @param string $table |
63 | - * @param string|array $fromFields |
|
63 | + * @param string $fromFields |
|
64 | 64 | * @param string $fromTable |
65 | - * @param string|array $where |
|
65 | + * @param string $where |
|
66 | 66 | * @param string $limit |
67 | 67 | * @return mixed |
68 | 68 | * @throws Exceptions\TableNotDefinedException |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @param string|array $fields |
84 | 84 | * @param string $table |
85 | - * @param string|array $where |
|
85 | + * @param string $where |
|
86 | 86 | * @return mixed |
87 | 87 | * @throws Exceptions\TableNotDefinedException |
88 | 88 | * @throws Exceptions\InvalidFieldException |
@@ -9,6 +9,7 @@ |
||
9 | 9 | |
10 | 10 | /** |
11 | 11 | * {@inheritDoc} |
12 | + * @param string $key |
|
12 | 13 | */ |
13 | 14 | public function getConfig($key = null) |
14 | 15 | { |
@@ -52,6 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | /** |
54 | 54 | * {@inheritDoc} |
55 | + * @return string |
|
55 | 56 | */ |
56 | 57 | abstract public function getLastError(); |
57 | 58 | |
@@ -80,6 +81,7 @@ discard block |
||
80 | 81 | |
81 | 82 | /** |
82 | 83 | * {@inheritDoc} |
84 | + * @param boolean $flag |
|
83 | 85 | */ |
84 | 86 | public function setDebug($flag) |
85 | 87 | { |
@@ -90,6 +92,7 @@ discard block |
||
90 | 92 | |
91 | 93 | /** |
92 | 94 | * {@inheritDoc} |
95 | + * @param string $query |
|
93 | 96 | */ |
94 | 97 | public function checkLastError($query = null) |
95 | 98 | { |
@@ -107,6 +110,8 @@ discard block |
||
107 | 110 | |
108 | 111 | /** |
109 | 112 | * {@inheritDoc} |
113 | + * @param string $sql |
|
114 | + * @param double $time |
|
110 | 115 | */ |
111 | 116 | public function collectQuery($result, $sql, $time) |
112 | 117 | { |
@@ -143,6 +148,7 @@ discard block |
||
143 | 148 | |
144 | 149 | /** |
145 | 150 | * {@inheritDoc} |
151 | + * @param string $query |
|
146 | 152 | */ |
147 | 153 | public function setLastQuery($query) |
148 | 154 | { |
@@ -207,6 +213,7 @@ discard block |
||
207 | 213 | |
208 | 214 | /** |
209 | 215 | * {@inheritDoc} |
216 | + * @param double $time |
|
210 | 217 | */ |
211 | 218 | public function addQueriesTime($time) |
212 | 219 | { |
@@ -257,7 +264,7 @@ discard block |
||
257 | 264 | } |
258 | 265 | |
259 | 266 | /** |
260 | - * @param array $errors |
|
267 | + * @param string[] $errors |
|
261 | 268 | * @return array |
262 | 269 | */ |
263 | 270 | public function setIgnoreErrors(array $errors) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | array_shift($debug); |
116 | 116 | $path = []; |
117 | 117 | foreach ($debug as $line) { |
118 | - $path[] = ($line['class'] ? ($line['class'] . '::') : null) . $line['function']; |
|
118 | + $path[] = ($line['class'] ? ($line['class'].'::') : null).$line['function']; |
|
119 | 119 | /*$path[] = [ |
120 | 120 | 'method' => ($line['class'] ? ($line['class'] . '::') : null) . $line['function'], |
121 | 121 | 'file' => ($line['file'] ? ($line['file'] . ':') : null) . ($line['line'] ?? 0) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setLastQuery($query) |
148 | 148 | { |
149 | - $this->lastQuery = (string)$query; |
|
149 | + $this->lastQuery = (string) $query; |
|
150 | 150 | |
151 | 151 | return $query; |
152 | 152 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getLastQuery() |
158 | 158 | { |
159 | - return (string)$this->lastQuery; |
|
159 | + return (string) $this->lastQuery; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function renderConnectionTime() |
222 | 222 | { |
223 | - return '<fieldset style="text-align:left">' . |
|
224 | - '<legend>Database connection</legend>' . |
|
225 | - 'Database connection was created in ' . $this->getConnectionTime(true) . ' s.' . |
|
226 | - '</fieldset>' . |
|
223 | + return '<fieldset style="text-align:left">'. |
|
224 | + '<legend>Database connection</legend>'. |
|
225 | + 'Database connection was created in '.$this->getConnectionTime(true).' s.'. |
|
226 | + '</fieldset>'. |
|
227 | 227 | '<br />'; |
228 | 228 | } |
229 | 229 | |
@@ -280,17 +280,17 @@ discard block |
||
280 | 280 | |
281 | 281 | foreach ($this->getAllExecutedQuery() as $i => $query) { |
282 | 282 | $out .= '<fieldset style="text-align:left">'; |
283 | - $out .= '<legend>Query ' . $i . ' - ' . sprintf($this->timeFormat, $query['time']) . '</legend>'; |
|
284 | - $out .= $query['sql'] . '<br><br>'; |
|
285 | - if (! empty($query['element'])) { |
|
286 | - $out .= $query['element']['type'] . ' => ' . $query['element']['name'] . '<br>'; |
|
283 | + $out .= '<legend>Query '.$i.' - '.sprintf($this->timeFormat, $query['time']).'</legend>'; |
|
284 | + $out .= $query['sql'].'<br><br>'; |
|
285 | + if (!empty($query['element'])) { |
|
286 | + $out .= $query['element']['type'].' => '.$query['element']['name'].'<br>'; |
|
287 | 287 | } |
288 | - if (! empty($query['event'])) { |
|
289 | - $out .= 'Current Event => ' . $query['event'] . '<br>'; |
|
288 | + if (!empty($query['event'])) { |
|
289 | + $out .= 'Current Event => '.$query['event'].'<br>'; |
|
290 | 290 | } |
291 | - $out .= 'Affected Rows => ' . $query['rows'] . '<br>'; |
|
292 | - if (! empty($query['path'])) { |
|
293 | - $out .= 'Functions Path => ' . $query['path'] . '<br>'; |
|
291 | + $out .= 'Affected Rows => '.$query['rows'].'<br>'; |
|
292 | + if (!empty($query['path'])) { |
|
293 | + $out .= 'Functions Path => '.$query['path'].'<br>'; |
|
294 | 294 | } |
295 | 295 | /*$out .= 'Functions Path => ' . $query['path']['method'] . '<br>'; |
296 | 296 | $out .= empty($query['path']['file']) ?: $query['path']['file'] . '<br />';*/ |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * @param int $timestamp |
29 | 29 | * @param string $fieldType |
30 | - * @return bool|false|string |
|
30 | + * @return string|false |
|
31 | 31 | * @deprecated |
32 | 32 | */ |
33 | 33 | public function convertDate($timestamp, $fieldType = 'DATETIME') |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | protected function convertValue($value) |
12 | 12 | { |
13 | 13 | switch (true) { |
14 | - case (\is_numeric($value) && ! \is_float(1 * $value)): |
|
15 | - $value = (int)$value; |
|
14 | + case (\is_numeric($value) && !\is_float(1 * $value)): |
|
15 | + $value = (int) $value; |
|
16 | 16 | break; |
17 | - case \is_numeric($value) && \is_float(1*$value): |
|
18 | - $value = (float)$value; |
|
17 | + case \is_numeric($value) && \is_float(1 * $value): |
|
18 | + $value = (float) $value; |
|
19 | 19 | break; |
20 | 20 | default: |
21 | 21 | break; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function convertDate($timestamp, $fieldType = 'DATETIME') |
34 | 34 | { |
35 | 35 | $date = false; |
36 | - if (! empty($timestamp) && $timestamp > 0) { |
|
36 | + if (!empty($timestamp) && $timestamp > 0) { |
|
37 | 37 | $format = [ |
38 | 38 | 'DATE' => 'Y-m-d', |
39 | 39 | 'TIME' => 'H:i:s', |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | if (\is_array($data)) { |
58 | 58 | $tmp = []; |
59 | 59 | foreach ($data as $alias => $field) { |
60 | - $tmp[] = ($alias !== $field && ! \is_int($alias) && $ignoreAlias === false) ? |
|
61 | - ($field . ' as `' . $alias . '`') : $field; |
|
60 | + $tmp[] = ($alias !== $field && !\is_int($alias) && $ignoreAlias === false) ? |
|
61 | + ($field.' as `'.$alias.'`') : $field; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $data = implode(',', $tmp); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $value = 'NULL'; |
83 | 83 | break; |
84 | 84 | case \is_scalar($value): |
85 | - $value = "'" . $value . "'"; |
|
85 | + $value = "'".$value."'"; |
|
86 | 86 | break; |
87 | 87 | default: |
88 | 88 | throw (new Exceptions\InvalidFieldException('NULL')) |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | } |
131 | 131 | $values = $this->withCommaSeparator($values); |
132 | 132 | if ($wrap === false) { |
133 | - $values = '(' . $values . ')'; |
|
133 | + $values = '('.$values.')'; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - if (! \is_scalar($values)) { |
|
137 | + if (!\is_scalar($values)) { |
|
138 | 138 | throw (new Exceptions\InvalidFieldException('values')) |
139 | 139 | ->setData($values); |
140 | 140 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | return compact('fields', 'values'); |
149 | 149 | } |
150 | 150 | |
151 | - return (empty($fields) ? '' : $fields . ' VALUES ') . $values; |
|
151 | + return (empty($fields) ? '' : $fields.' VALUES ').$values; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($this->arrayOnlyNumeric($fields) === true) { |
164 | 164 | $fields = ($level === 2) ? false : ''; |
165 | 165 | } else { |
166 | - $fields = '(`' . implode('`, `', $fields) . '`)'; |
|
166 | + $fields = '(`'.implode('`, `', $fields).'`)'; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $onlyNumbers = true; |
180 | 180 | foreach ($data as $value) { |
181 | - if (! \is_numeric($value)) { |
|
181 | + if (!\is_numeric($value)) { |
|
182 | 182 | $onlyNumbers = false; |
183 | 183 | break; |
184 | 184 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | foreach ($data as $key => $value) { |
203 | - $data[$key] = "`{$key}` = " . $value; |
|
203 | + $data[$key] = "`{$key}` = ".$value; |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | $data = implode(' ', $tmp); |
224 | 224 | } |
225 | - if (! is_scalar($data) || empty($data)) { |
|
225 | + if (!is_scalar($data) || empty($data)) { |
|
226 | 226 | throw new Exceptions\TableNotDefinedException($data); |
227 | 227 | } |
228 | 228 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | $data = trim($data); |
248 | - if (! empty($data) && stripos($data, 'WHERE') !== 0) { |
|
248 | + if (!empty($data) && stripos($data, 'WHERE') !== 0) { |
|
249 | 249 | $data = "WHERE {$data}"; |
250 | 250 | } |
251 | 251 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | protected function prepareOrder($data) |
260 | 260 | { |
261 | 261 | $data = trim($data); |
262 | - if (! empty($data) && stripos($data, 'ORDER') !== 0) { |
|
262 | + if (!empty($data) && stripos($data, 'ORDER') !== 0) { |
|
263 | 263 | $data = "ORDER BY {$data}"; |
264 | 264 | } |
265 | 265 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | protected function prepareLimit($data) |
274 | 274 | { |
275 | 275 | $data = trim($data); |
276 | - if (! empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
276 | + if (!empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
277 | 277 | $data = "LIMIT {$data}"; |
278 | 278 | } |
279 | 279 |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | $data = trim($data); |
248 | 248 | if (! empty($data) && stripos($data, 'WHERE') !== 0) { |
249 | - $data = "WHERE {$data}"; |
|
249 | + $data = "where {$data}"; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $data; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $data = trim($data); |
276 | 276 | if (! empty($data) && stripos($data, 'LIMIT') !== 0) { |
277 | - $data = "LIMIT {$data}"; |
|
277 | + $data = "limit {$data}"; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $data; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php namespace AgelxNash\Modx\Evo\Database\Tests; |
2 | 2 | |
3 | -use PHPUnit\Framework\TestCase; |
|
4 | 3 | use AgelxNash\Modx\Evo\Database; |
4 | +use PHPUnit\Framework\TestCase; |
|
5 | 5 | |
6 | 6 | class LegacyDatabaseTest extends TestCase |
7 | 7 | { |
@@ -15,9 +15,9 @@ |
||
15 | 15 | $this->instance = new Database\LegacyDatabase( |
16 | 16 | isset($_SERVER['DB_HOST']) ? $_SERVER['DB_HOST'] : 'localhost', |
17 | 17 | isset($_SERVER['DB_BASE']) ? $_SERVER['DB_BASE'] : 'modx', |
18 | - isset($_SERVER['DB_USER']) ? $_SERVER['DB_USER'] : 'homestead', |
|
19 | - isset($_SERVER['DB_PASSWORD']) ? $_SERVER['DB_PASSWORD'] : 'secret', |
|
20 | - isset($_SERVER['DB_PREFIX']) ? $_SERVER['DB_PREFIX'] : '{PREFIX}', |
|
18 | + isset($_SERVER['DB_USER']) ? $_SERVER['DB_USER'] : 'homestead', |
|
19 | + isset($_SERVER['DB_PASSWORD']) ? $_SERVER['DB_PASSWORD'] : 'secret', |
|
20 | + isset($_SERVER['DB_PREFIX']) ? $_SERVER['DB_PREFIX'] : '{PREFIX}', |
|
21 | 21 | isset($_SERVER['DB_CHARSET']) ? $_SERVER['DB_CHARSET'] : 'utf8mb4', |
22 | 22 | isset($_SERVER['DB_METHOD']) ? $_SERVER['DB_METHOD'] : 'SET NAMES', |
23 | 23 | isset($_SERVER['DB_COLLATION']) ? $_SERVER['DB_COLLATION'] : 'utf8mb4_unicode_ci', |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $this->assertEquals( |
33 | 33 | $this->instance->query("SELECT count(*) FROM [+prefix+]site_content"), |
34 | - $this->instance->query("SELECT count(*) FROM " . $this->instance->getFullTableName('site_content')) |
|
34 | + $this->instance->query("SELECT count(*) FROM ".$this->instance->getFullTableName('site_content')) |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | $allQuery = $this->instance->getAllExecutedQuery(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $queries = [ |
70 | 70 | "SELECT count(*) FROM [+prefix+]site_content", |
71 | - "SELECT count(*) FROM " . $this->instance->getFullTableName('site_content') |
|
71 | + "SELECT count(*) FROM ".$this->instance->getFullTableName('site_content') |
|
72 | 72 | ]; |
73 | 73 | |
74 | 74 | $this->assertCount( |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php namespace AgelxNash\Modx\Evo\Database\Tests; |
2 | 2 | |
3 | -use PHPUnit\Framework\TestCase; |
|
4 | 3 | use AgelxNash\Modx\Evo\Database; |
5 | 4 | use Illuminate\Database\Capsule\Manager as Capsule; |
5 | +use PHPUnit\Framework\TestCase; |
|
6 | 6 | |
7 | 7 | class MultiConnectTest extends TestCase |
8 | 8 | { |