diff --git a/tests/Support/Assert.php b/tests/Support/Assert.php deleted file mode 100644 index 92d398f..0000000 --- a/tests/Support/Assert.php +++ /dev/null @@ -1,100 +0,0 @@ -hasProperty($propertyName)) { - $class = $class->getParentClass(); - } - - $property = $class->getProperty($propertyName); - - $property->setAccessible(true); - - /** @psalm-var mixed $result */ - $result = $property->getValue($object); - - if ($revoke) { - $property->setAccessible(false); - } - - return $result; - } - - /** - * Sets an inaccessible object property. - * - * @param object $object The object to set the property on. - * @param string $propertyName The name of the property to set. - * @param mixed $value The value to set. - */ - public static function setInaccessibleProperty(object $object, string $propertyName, mixed $value): void - { - $class = new ReflectionClass($object); - - while (!$class->hasProperty($propertyName)) { - $class = $class->getParentClass(); - } - - $property = $class->getProperty($propertyName); - $property->setAccessible(true); - $property->setValue($object, $value); - } - - /** - * Invokes an inaccessible method. - * - * @param object $object The object to invoke the method on. - * @param string $method The name of the method to invoke. - * @param array $args The arguments to pass to the method. - * - * @throws ReflectionException - */ - public static function invokeMethod(object $object, string $method, array $args = []): mixed - { - $reflection = new ReflectionObject($object); - $method = $reflection->getMethod($method); - $method->setAccessible(true); - - return $method->invokeArgs($object, $args); - } -} diff --git a/tests/Support/DbHelper.php b/tests/Support/DbHelper.php deleted file mode 100644 index 04112cf..0000000 --- a/tests/Support/DbHelper.php +++ /dev/null @@ -1,67 +0,0 @@ -open(); - - if ($db->getDriverName() === 'oci') { - [$drops, $creates] = explode('/* STATEMENTS */', file_get_contents($fixture), 2); - [$statements, $triggers, $data] = explode('/* TRIGGERS */', $creates, 3); - $lines = array_merge( - explode('--', $drops), - explode(';', $statements), - explode('/', $triggers), - explode(';', $data) - ); - } else { - $lines = explode(';', file_get_contents($fixture)); - } - - foreach ($lines as $line) { - if (trim($line) !== '') { - $db->getPDO()?->exec($line); - } - } - } - - /** - * Adjust dbms specific escaping. - * - * @param string $sql string SQL statement to adjust. - * @param string $driverName string DBMS name. - * - * @return mixed - */ - public static function replaceQuotes(string $sql, string $driverName): string - { - return match ($driverName) { - 'mysql', 'sqlite' => str_replace(['[[', ']]'], '`', $sql), - 'oci' => str_replace(['[[', ']]'], '"', $sql), - 'pgsql' => str_replace(['\\[', '\\]'], ['[', ']'], preg_replace('/(\[\[)|((? str_replace(['[[', ']]'], ['[', ']'], $sql), - default => $sql, - }; - } -} diff --git a/tests/Support/TraversableObject.php b/tests/Support/TraversableObject.php deleted file mode 100644 index eadfad6..0000000 --- a/tests/Support/TraversableObject.php +++ /dev/null @@ -1,57 +0,0 @@ -data[$this->position]; - } - - public function next(): void - { - $this->position++; - } - - public function key(): int - { - return $this->position; - } - - public function valid(): bool - { - return array_key_exists($this->position, $this->data); - } - - public function rewind(): void - { - $this->position = 0; - } -}