1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00
This commit is contained in:
J. King 2017-12-31 17:30:30 -05:00
parent 77793f95cb
commit 65b08d1735
3 changed files with 25 additions and 26 deletions

View file

@ -8,17 +8,5 @@ namespace JKingWeb\Arsse\TestCase\REST\NextCloudNews\PDO;
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended> */ /** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended> */
class TestV1_2 extends \JKingWeb\Arsse\TestCase\REST\NextCloudNews\TestV1_2 { class TestV1_2 extends \JKingWeb\Arsse\TestCase\REST\NextCloudNews\TestV1_2 {
protected function v($value) { use \JKingWeb\Arsse\Test\PDOTest;
if (!is_array($value)) {
return $value;
}
foreach($value as $k => $v) {
if (is_array($v)) {
$value[$k] = $this->v($v);
} elseif (is_int($v) || is_float($v)) {
$value[$k] = (string) $v;
}
}
return $value;
}
} }

View file

@ -9,17 +9,5 @@ namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\PDO;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended> /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */ * @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
class TestAPI extends \JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\TestAPI { class TestAPI extends \JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\TestAPI {
protected function v($value) { use \JKingWeb\Arsse\Test\PDOTest;
if (!is_array($value)) {
return $value;
}
foreach($value as $k => $v) {
if (is_array($v)) {
$value[$k] = $this->v($v);
} elseif (is_int($v) || is_float($v)) {
$value[$k] = (string) $v;
}
}
return $value;
}
} }

23
tests/lib/PDOTest.php Normal file
View file

@ -0,0 +1,23 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test;
trait PDOTest {
protected function v($value) {
if (!is_array($value)) {
return $value;
}
foreach($value as $k => $v) {
if (is_array($v)) {
$value[$k] = $this->v($v);
} elseif (is_int($v) || is_float($v)) {
$value[$k] = (string) $v;
}
}
return $value;
}
}