Skip to content

Commit

Permalink
tests for using filter to apply the latest view if it doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
alkemann committed Nov 17, 2009
1 parent 9dad739 commit fdb1ad0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/integration/PasteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,28 @@ public function testReadNotFound() {
}

public function testLatestView() {
$this->setUpTasks(array('PutTable','PutView','FillTableFull'));
$this->setUpTasks(array('PutTable','FillTableFull'));
MockPaste::applyFilter('find', function($self, $params, $chain) {
var_dump($params);
if ($params['options']['conditions']['design'] = 'latest') {
$conditions = $params['options']['conditions'];
$result = $chain->next($self, $params, $chain);
if ($result === null) {
MockPaste::createView()->save();
return null; //static::find('all', $conditions);
}
return $result;
} else {
return $chain->next($self, $params, $chain);
}
});
$latest = MockPaste::find('all', array('conditions'=> array(
'design' => 'latest',
'view' => 'all',
'limit' => '10',
'descending' => 'true'
)));
$this->assertNull($latest);

$latest = MockPaste::find('all', array('conditions'=> array(
'design' => 'latest',
Expand Down

0 comments on commit fdb1ad0

Please sign in to comment.