J. King
7 years ago
4 changed files with 72 additions and 5 deletions
@ -0,0 +1,25 @@ |
|||||
|
<?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\Db; |
||||
|
|
||||
|
use JKingWeb\Arsse\Db\Exception; |
||||
|
|
||||
|
class ResultEmpty extends AbstractResult { |
||||
|
public function changes() { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
public function lastId() { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
// PHP iterator methods |
||||
|
|
||||
|
public function valid() { |
||||
|
return false; |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
<?php |
||||
|
declare(strict_types=1); |
||||
|
namespace JKingWeb\Arsse; |
||||
|
|
||||
|
/** @covers \JKingWeb\Arsse\Db\ResultEmpty<extended> */ |
||||
|
class TestResultEmpty extends Test\AbstractTest { |
||||
|
|
||||
|
public function testGetChangeCountAndLastInsertId() { |
||||
|
$r = new Db\ResultEmpty; |
||||
|
$this->assertEquals(0, $r->changes()); |
||||
|
$this->assertEquals(0, $r->lastId()); |
||||
|
} |
||||
|
|
||||
|
public function testIterateOverResults() { |
||||
|
$rows = []; |
||||
|
foreach (new Db\ResultEmpty as $index => $row) { |
||||
|
$rows[$index] = $row['col']; |
||||
|
} |
||||
|
$this->assertEquals([], $rows); |
||||
|
} |
||||
|
|
||||
|
public function testGetSingleValues() { |
||||
|
$test = new Db\ResultEmpty; |
||||
|
$this->assertSame(null, $test->getValue()); |
||||
|
} |
||||
|
|
||||
|
public function testGetRows() { |
||||
|
$test = new Db\ResultEmpty; |
||||
|
$this->assertSame(null, $test->getRow()); |
||||
|
} |
||||
|
|
||||
|
public function testGetAllRows() { |
||||
|
$test = new Db\ResultEmpty; |
||||
|
$rows = []; |
||||
|
$this->assertEquals($rows, $test->getAll()); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue