|
@@ 232-265 (lines=34) @@
|
| 229 |
|
/** |
| 230 |
|
* @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
| 231 |
|
*/ |
| 232 |
|
public function testSetStatus() |
| 233 |
|
{ |
| 234 |
|
$gateway = $this->getDatabaseGateway(); |
| 235 |
|
|
| 236 |
|
// insert content |
| 237 |
|
$struct = $this->getCreateStructFixture(); |
| 238 |
|
$contentId = $gateway->insertContentObject($struct); |
| 239 |
|
|
| 240 |
|
// insert version |
| 241 |
|
$version = $this->getVersionFixture(); |
| 242 |
|
$version->contentInfo->id = $contentId; |
| 243 |
|
$gateway->insertVersion($version, array()); |
| 244 |
|
|
| 245 |
|
$this->assertTrue( |
| 246 |
|
$gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PENDING) |
| 247 |
|
); |
| 248 |
|
|
| 249 |
|
$this->assertQueryResult( |
| 250 |
|
array(array(VersionInfo::STATUS_PENDING)), |
| 251 |
|
$this->getDatabaseHandler() |
| 252 |
|
->createSelectQuery() |
| 253 |
|
->select('status') |
| 254 |
|
->from('ezcontentobject_version') |
| 255 |
|
); |
| 256 |
|
|
| 257 |
|
// check that content status has not been set to published |
| 258 |
|
$this->assertQueryResult( |
| 259 |
|
array(array(VersionInfo::STATUS_DRAFT)), |
| 260 |
|
$this->getDatabaseHandler() |
| 261 |
|
->createSelectQuery() |
| 262 |
|
->select('status') |
| 263 |
|
->from('ezcontentobject') |
| 264 |
|
); |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
/** |
| 268 |
|
* @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
|
@@ 270-303 (lines=34) @@
|
| 267 |
|
/** |
| 268 |
|
* @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |
| 269 |
|
*/ |
| 270 |
|
public function testSetStatusPublished() |
| 271 |
|
{ |
| 272 |
|
$gateway = $this->getDatabaseGateway(); |
| 273 |
|
|
| 274 |
|
// insert content |
| 275 |
|
$struct = $this->getCreateStructFixture(); |
| 276 |
|
$contentId = $gateway->insertContentObject($struct); |
| 277 |
|
|
| 278 |
|
// insert version |
| 279 |
|
$version = $this->getVersionFixture(); |
| 280 |
|
$version->contentInfo->id = $contentId; |
| 281 |
|
$gateway->insertVersion($version, array()); |
| 282 |
|
|
| 283 |
|
$this->assertTrue( |
| 284 |
|
$gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PUBLISHED) |
| 285 |
|
); |
| 286 |
|
|
| 287 |
|
$this->assertQueryResult( |
| 288 |
|
array(array(VersionInfo::STATUS_PUBLISHED)), |
| 289 |
|
$this->getDatabaseHandler() |
| 290 |
|
->createSelectQuery() |
| 291 |
|
->select('status') |
| 292 |
|
->from('ezcontentobject_version') |
| 293 |
|
); |
| 294 |
|
|
| 295 |
|
// check that content status has been set to published |
| 296 |
|
$this->assertQueryResult( |
| 297 |
|
array(array(ContentInfo::STATUS_PUBLISHED)), |
| 298 |
|
$this->getDatabaseHandler() |
| 299 |
|
->createSelectQuery() |
| 300 |
|
->select('status') |
| 301 |
|
->from('ezcontentobject') |
| 302 |
|
); |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
/** |
| 306 |
|
* @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus |