for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TheCodingMachine\TDBM;
use PHPUnit\Framework\TestCase;
class EmptyInnerResultIteratorTest extends TestCase
{
public function testOffsetUnset()
$iterator = new EmptyInnerResultIterator();
$this->expectException(TDBMInvalidOperationException::class);
unset($iterator[42]);
}
public function testCount()
$this->assertCount(0, $iterator);
public function testOffsetExists()
$this->assertFalse(isset($iterator[0]));
public function testOffsetSet()
$iterator[42] = 'foo';
public function testIterate()
foreach ($iterator as $elem) {
$this->fail('Iterator should be empty');
$iterator->next();
$this->assertNull($iterator->current());
$iterator->current()
TheCodingMachine\TDBM\Em...sultIterator::current()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$this->assertNull($iterator->key());
$iterator->key()
TheCodingMachine\TDBM\Em...erResultIterator::key()
public function testOffsetGet()
$this->expectException(TDBMInvalidOffsetException::class);
$iterator[42];
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.