| @@ 215-248 (lines=34) @@ | ||
| 212 | /** |
|
| 213 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
|
| 214 | */ |
|
| 215 | public function testSetStatus() |
|
| 216 | { |
|
| 217 | $gateway = $this->getDatabaseGateway(); |
|
| 218 | ||
| 219 | // insert content |
|
| 220 | $struct = $this->getCreateStructFixture(); |
|
| 221 | $contentId = $gateway->insertContentObject($struct); |
|
| 222 | ||
| 223 | // insert version |
|
| 224 | $version = $this->getVersionFixture(); |
|
| 225 | $version->contentInfo->id = $contentId; |
|
| 226 | $gateway->insertVersion($version, []); |
|
| 227 | ||
| 228 | $this->assertTrue( |
|
| 229 | $gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PENDING) |
|
| 230 | ); |
|
| 231 | ||
| 232 | $this->assertQueryResult( |
|
| 233 | [[VersionInfo::STATUS_PENDING]], |
|
| 234 | $this->getDatabaseHandler() |
|
| 235 | ->createSelectQuery() |
|
| 236 | ->select('status') |
|
| 237 | ->from('ezcontentobject_version') |
|
| 238 | ); |
|
| 239 | ||
| 240 | // check that content status has not been set to published |
|
| 241 | $this->assertQueryResult( |
|
| 242 | [[VersionInfo::STATUS_DRAFT]], |
|
| 243 | $this->getDatabaseHandler() |
|
| 244 | ->createSelectQuery() |
|
| 245 | ->select('status') |
|
| 246 | ->from('ezcontentobject') |
|
| 247 | ); |
|
| 248 | } |
|
| 249 | ||
| 250 | /** |
|
| 251 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
|
| @@ 253-286 (lines=34) @@ | ||
| 250 | /** |
|
| 251 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
|
| 252 | */ |
|
| 253 | public function testSetStatusPublished() |
|
| 254 | { |
|
| 255 | $gateway = $this->getDatabaseGateway(); |
|
| 256 | ||
| 257 | // insert content |
|
| 258 | $struct = $this->getCreateStructFixture(); |
|
| 259 | $contentId = $gateway->insertContentObject($struct); |
|
| 260 | ||
| 261 | // insert version |
|
| 262 | $version = $this->getVersionFixture(); |
|
| 263 | $version->contentInfo->id = $contentId; |
|
| 264 | $gateway->insertVersion($version, []); |
|
| 265 | ||
| 266 | $this->assertTrue( |
|
| 267 | $gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PUBLISHED) |
|
| 268 | ); |
|
| 269 | ||
| 270 | $this->assertQueryResult( |
|
| 271 | [[VersionInfo::STATUS_PUBLISHED]], |
|
| 272 | $this->getDatabaseHandler() |
|
| 273 | ->createSelectQuery() |
|
| 274 | ->select('status') |
|
| 275 | ->from('ezcontentobject_version') |
|
| 276 | ); |
|
| 277 | ||
| 278 | // check that content status has been set to published |
|
| 279 | $this->assertQueryResult( |
|
| 280 | [[ContentInfo::STATUS_PUBLISHED]], |
|
| 281 | $this->getDatabaseHandler() |
|
| 282 | ->createSelectQuery() |
|
| 283 | ->select('status') |
|
| 284 | ->from('ezcontentobject') |
|
| 285 | ); |
|
| 286 | } |
|
| 287 | ||
| 288 | /** |
|
| 289 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
|