[DDC-3076] Add/Improve tests
This commit is contained in:
parent
df020e08a0
commit
8740d54210
@ -1926,4 +1926,34 @@ class ObjectHydratorTest extends HydrationTestCase
|
||||
$hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em);
|
||||
$hydrator->hydrateAll($stmt, $rsm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-3076
|
||||
*
|
||||
* @expectedException \Doctrine\ORM\Internal\Hydration\HydrationException
|
||||
* @expectedExceptionMessage The discriminator value "subworker" is invalid. It must be one of "person", "manager", "employee".
|
||||
*/
|
||||
public function testInvalidDiscriminatorValueException()
|
||||
{
|
||||
$rsm = new ResultSetMapping;
|
||||
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\Company\CompanyPerson', 'p');
|
||||
|
||||
$rsm->addFieldResult('p', 'p__id', 'id');
|
||||
$rsm->addFieldResult('p', 'p__name', 'name');
|
||||
$rsm->addMetaResult('p', 'discr', 'discr');
|
||||
$rsm->setDiscriminatorColumn('p', 'discr');
|
||||
|
||||
$resultSet = array(
|
||||
array(
|
||||
'p__id' => '1',
|
||||
'p__name' => 'Fabio B. Silva',
|
||||
'discr' => 'subworker'
|
||||
),
|
||||
);
|
||||
|
||||
$stmt = new HydratorMockStatement($resultSet);
|
||||
$hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em);
|
||||
$hydrator->hydrateAll($stmt, $rsm);
|
||||
}
|
||||
}
|
||||
|
@ -66,15 +66,18 @@ class SimpleObjectHydratorTest extends HydrationTestCase
|
||||
public function testInvalidDiscriminatorValueException()
|
||||
{
|
||||
$rsm = new ResultSetMapping;
|
||||
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\Company\CompanyPerson', 'p');
|
||||
|
||||
$rsm->addFieldResult('p', 'p__id', 'id');
|
||||
$rsm->addFieldResult('p', 'p__name', 'name');
|
||||
$rsm->addMetaResult('p ', 'discr', 'discr');
|
||||
$rsm->addMetaResult('p', 'discr', 'discr');
|
||||
$rsm->setDiscriminatorColumn('p', 'discr');
|
||||
|
||||
$resultSet = array(
|
||||
array(
|
||||
'u__id' => '1',
|
||||
'u__name' => 'Fabio B. Silva',
|
||||
'p__id' => '1',
|
||||
'p__name' => 'Fabio B. Silva',
|
||||
'discr' => 'subworker'
|
||||
),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user