|
@@ 123-131 (lines=9) @@
|
| 120 |
|
$this->assertNotNull($user); |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
public function testUsingUnknownQueryParameterShouldThrowException() |
| 124 |
|
{ |
| 125 |
|
$this->expectException(QueryException::class); |
| 126 |
|
$this->expectExceptionMessage('Invalid parameter: token 2 is not defined in the query.'); |
| 127 |
|
|
| 128 |
|
$q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1'); |
| 129 |
|
$q->setParameter(2, 'jwage'); |
| 130 |
|
$user = $q->getSingleResult(); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
public function testTooManyParametersShouldThrowException() |
| 134 |
|
{ |
|
@@ 133-143 (lines=11) @@
|
| 130 |
|
$user = $q->getSingleResult(); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
public function testTooManyParametersShouldThrowException() |
| 134 |
|
{ |
| 135 |
|
$this->expectException(QueryException::class); |
| 136 |
|
$this->expectExceptionMessage('Too many parameters: the query defines 1 parameters and you bound 2'); |
| 137 |
|
|
| 138 |
|
$q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1'); |
| 139 |
|
$q->setParameter(1, 'jwage'); |
| 140 |
|
$q->setParameter(2, 'jwage'); |
| 141 |
|
|
| 142 |
|
$user = $q->getSingleResult(); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
public function testTooFewParametersShouldThrowException() |
| 146 |
|
{ |