lithium\tests\mocks\data\MockComment::find PHP Method

find() public static method

public static find ( $type, array $options = [] )
$options array
    public static function find($type, array $options = array())
    {
        $defaults = array('conditions' => null, 'fields' => null, 'order' => null, 'limit' => null, 'page' => 1);
        $options += $defaults;
        $params = compact('type', 'options');
        $self = static::_object();
        $filter = function ($self, $params) {
            $query = new Query(array('type' => 'read') + $params['options']);
            return new RecordSet(array('query' => $query, 'data' => array_map(function ($data) {
                return new Record(compact('data') + array('model' => __CLASS__));
            }, array(array('comment_id' => 1, 'author_id' => 123, 'text' => 'First comment'), array('comment_id' => 2, 'author_id' => 241, 'text' => 'Second comment'), array('comment_id' => 3, 'author_id' => 451, 'text' => 'Third comment')))));
        };
        $finder = isset($self->_finders[$type]) ? array($self->_finders[$type]) : array();
        return static::_filter(__METHOD__, $params, $filter, $finder);
    }

Usage Example

Beispiel #1
0
 public function testSimpleFindList()
 {
     $result = MockComment::find('list');
     $this->assertNotEmpty($result);
     $this->assertInternalType('array', $result);
 }
All Usage Examples Of lithium\tests\mocks\data\MockComment::find
MockComment