public function testShouldGetFirstProjectingFields()
{
// Arrange
$connPool = m::mock(Pool::class);
$mapper = m::mock(DataMapper::class . '[prepareValueQuery,getCollection]', [$connPool]);
$schema = m::mock(Schema::class);
$collection = m::mock(Collection::class);
$query = 123;
$preparedQuery = ['_id' => 123];
$projection = ['project' => true, 'fields' => false];
$schema->entityClass = 'stdClass';
$mapper->setSchema($schema);
$mapper->shouldAllowMockingProtectedMethods();
// Expect
$mapper->shouldReceive('prepareValueQuery')->once()->with($query)->andReturn($preparedQuery);
$mapper->shouldReceive('getCollection')->once()->andReturn($collection);
$collection->shouldReceive('findOne')->once()->with($preparedQuery, ['projection' => $projection])->andReturn(null);
// Act
$result = $mapper->first($query, $projection);
// Assert
$this->assertNull($result);
}