Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hidden fields triggering error when using getSingleScalarResult() #8340

Prev Previous commit
Next Next commit
Fix Coding Standards (7.4) - Fix more things
  • Loading branch information
Mediagone committed Nov 13, 2020
commit 335385bb883d9005bd6e362c1a72309e8672637e
10 changes: 4 additions & 6 deletions tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function singleScalarResultSetProvider(): array
*/
public function testHydrateSingleScalar($name, $resultSet)
{
$rsm = new ResultSetMapping;
$rsm = new ResultSetMapping();
$rsm->addEntityResult(CmsUser::class, 'u');
$rsm->addFieldResult('u', 'u__id', 'id');
$rsm->addFieldResult('u', 'u__name', 'name');
Expand Down Expand Up @@ -124,21 +124,20 @@ public static function singleScalarResultSetWithHiddenFieldProvider() : array
}

/**
*
* @dataProvider singleScalarResultSetWithHiddenFieldProvider
*/
public function testHydrateSingleScalarWithHiddenField($name, $resultSet)
Mediagone marked this conversation as resolved.
Show resolved Hide resolved
{
$rsm = new ResultSetMapping;
$rsm = new ResultSetMapping();
$rsm->addScalarResult('u__id', 'id', 'string');

$stmt = new HydratorMockStatement($resultSet);
$stmt = new HydratorMockStatement($resultSet);
$hydrator = new SingleScalarHydrator($this->_em);

if ($name === 'result1') {
$result = $hydrator->hydrateAll($stmt, $rsm);
$this->assertEquals('1', $result);

return;
}

Expand All @@ -156,5 +155,4 @@ public function testHydrateSingleScalarWithHiddenField($name, $resultSet)
return;
}
}

}