Skip to content

Instantly share code, notes, and snippets.

@icambridge
Created January 21, 2012 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icambridge/1652449 to your computer and use it in GitHub Desktop.
Save icambridge/1652449 to your computer and use it in GitHub Desktop.
Mock Model Class
<?php
namespace app\tests\mocks\models;
use lithium\data\collection\RecordSet;
class Articles extends \app\models\Articles {
public static function find($type = 'all', array $options = array()) {
switch($type) {
case 'first':
return new RecordSet(array('data' => array(
'id' => 1, 'title' => 'Top ten reasons why this is a bad title.'
)));
break;
case 'all':
default :
return new RecordSet(array('data' => array(
array('id' => 1, 'title' => 'Top ten reasons why this is a bad title.'),
array('id' => 2, 'title' => 'Sensationalist Over-dramatization!'),
array('id' => 3, 'title' => 'Heavy Editorializing!'),
)));
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment