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