protected function doGet(Version $version) { $table = $this->getTable(); $parameter = $this->getFilterParameter(); $condition = FilterParameter::getCondition($parameter); return array('startIndex' => $parameter->getStartIndex() ?: 0, 'count' => $parameter->getCount() ?: 16, 'totalResults' => $table->getCount(), 'entry' => $table->getAll($parameter->getStartIndex(), $parameter->getCount(), $parameter->getSortBy(), $parameter->getSortOrder(), $condition)); }
public function doInspect() { $params = $this->getFilterParameter(); $this->testCase->assertEquals(array('foo', 'bar'), $params->getFields()); $this->testCase->assertEquals('2014-01-26', $params->getUpdatedSince()->format('Y-m-d')); $this->testCase->assertEquals(8, $params->getCount()); $this->testCase->assertEquals('id', $params->getFilterBy()); $this->testCase->assertEquals('equals', $params->getFilterOp()); $this->testCase->assertEquals('12', $params->getFilterValue()); $this->testCase->assertEquals('id', $params->getSortBy()); $this->testCase->assertEquals(Sql::SORT_DESC, $params->getSortOrder()); $this->testCase->assertEquals(4, $params->getStartIndex()); $condition = FilterParameter::getCondition($params); $this->testCase->assertEquals(array(array('id', '=', '12', 'AND', 1), array('date', '>', '2014-01-26 00:00:00', 'AND', 1)), $condition->toArray()); // check writer $this->testCase->assertTrue($this->isWriter('PSX\\Data\\Writer\\Json')); }