RedUNIT\Base\Finding::testFindLike PHP Method

testFindLike() public method

Tests the findLike method.
public testFindLike ( ) : void
return void
    public function testFindLike()
    {
        R::nuke();
        $book = R::dispense(array('_type' => 'book', 'title' => 'my book', 'price' => 80));
        R::store($book);
        $book = R::dispense(array('_type' => 'book', 'title' => 'other book', 'price' => 80));
        R::store($book);
        $books = R::findLike('book', array('price' => 80));
        asrt(count($books), 2);
        foreach ($books as $book) {
            asrt($book->getMeta('type'), 'book');
        }
        $books = R::findLike('book');
        asrt(count($books), 2);
        $books = R::findLike('book', array('title' => 'my book'));
        asrt(count($books), 1);
        $books = R::findLike('book', array('title' => array('my book', 'other book')));
        asrt(count($books), 2);
        $books = R::findLike('book', array('title' => 'strange book'));
        asrt(is_array($books), TRUE);
        asrt(count($books), 0);
        $books = R::findLike('magazine');
        asrt(is_array($books), TRUE);
        asrt(count($books), 0);
    }