ImboUnitTest\Http\Response\Formatter\JSONTest::testCanFormatGroupsModel PHP Method

testCanFormatGroupsModel() public method

    public function testCanFormatGroupsModel()
    {
        $groups = ['group', 'othergroup'];
        $count = count($groups);
        $hits = 2;
        $limit = 5;
        $page = 1;
        $model = $this->getMock('Imbo\\Model\\Groups');
        $model->expects($this->once())->method('getHits')->will($this->returnValue($hits));
        $model->expects($this->once())->method('getPage')->will($this->returnValue($page));
        $model->expects($this->once())->method('getLimit')->will($this->returnValue($limit));
        $model->expects($this->once())->method('getCount')->will($this->returnValue($count));
        $model->expects($this->once())->method('getGroups')->will($this->returnValue($groups));
        $this->assertSame('{"search":{"hits":2,"page":1,"limit":5,"count":2},"groups":["group","othergroup"]}', $this->formatter->format($model));
    }