Mongolid\ActiveRecordTest::testShouldGetAll PHP Method

testShouldGetAll() public method

public testShouldGetAll ( )
    public function testShouldGetAll()
    {
        // Arrage
        $entity = m::mock(ActiveRecord::class . '[getDataMapper]');
        $this->setProtected($entity, 'collection', 'mongolid');
        $dataMapper = m::mock();
        $cursor = m::mock();
        // Act
        Ioc::instance(get_class($entity), $entity);
        $entity->shouldReceive('getDataMapper')->andReturn($dataMapper);
        $dataMapper->shouldReceive('all')->once()->andReturn($cursor);
        // Assert
        $this->assertEquals($cursor, $entity->all());
    }