The clean & modern RSS server that doesn't give you any crap. https://thearsse.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestResultPDO.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /** @license MIT
  3. * Copyright 2017 J. King, Dustin Wilson et al.
  4. * See LICENSE and AUTHORS files for details */
  5. declare(strict_types=1);
  6. namespace JKingWeb\Arsse\TestCase\Db;
  7. use JKingWeb\Arsse\Test\DatabaseInformation;
  8. /**
  9. * @covers \JKingWeb\Arsse\Db\PDOResult<extended>
  10. */
  11. class TestResultPDO extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
  12. protected static $implementation;
  13. public static function setUpBeforeClass() {
  14. self::setConf();
  15. // we only need to test one PDO implementation (they all use the same result class), so we find the first usable one
  16. $drivers = DatabaseInformation::listPDO();
  17. self::$implementation = $drivers[0];
  18. foreach ($drivers as $driver) {
  19. $info = new DatabaseInformation($driver);
  20. $interface = ($info->interfaceConstructor)();
  21. if ($interface) {
  22. self::$implementation = $driver;
  23. break;
  24. }
  25. }
  26. unset($interface);
  27. unset($info);
  28. parent::setUpBeforeClass();
  29. }
  30. protected function makeResult(string $q): array {
  31. $set = static::$interface->query($q);
  32. $rows = $set->rowCount();
  33. $id = static::$interface->lastInsertID();
  34. return [$set, [$rows, $id]];
  35. }
  36. }