Code Duplication    Length = 37-37 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/Tests/ContentHandlerTest.php 2 locations

@@ 444-480 (lines=37) @@
441
    /**
442
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
443
     */
444
    public function testSetStatus()
445
    {
446
        $this->loggerMock->expects($this->once())->method('logCall');
447
448
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
449
        $this->persistenceHandlerMock
450
            ->expects($this->once())
451
            ->method('contentHandler')
452
            ->will($this->returnValue($innerHandlerMock));
453
454
        $innerHandlerMock
455
            ->expects($this->once())
456
            ->method('setStatus')
457
            ->with(2, VersionInfo::STATUS_ARCHIVED, 1)
458
            ->will($this->returnValue(true));
459
460
        $this->cacheMock
461
            ->expects($this->at(0))
462
            ->method('clear')
463
            ->with('content', 2, 1)
464
            ->will($this->returnValue(null));
465
466
        $this->cacheMock
467
            ->expects($this->at(1))
468
            ->method('clear')
469
            ->with('content', 2, ContentHandler::PUBLISHED_VERSION)
470
            ->will($this->returnValue(null));
471
472
        $this->cacheMock
473
            ->expects($this->at(2))
474
            ->method('clear')
475
            ->with('content', 'info', 2, 'versioninfo', 1)
476
            ->will($this->returnValue(null));
477
478
        $handler = $this->persistenceCacheHandler->contentHandler();
479
        $handler->setStatus(2, VersionInfo::STATUS_ARCHIVED, 1);
480
    }
481
482
    /**
483
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
@@ 485-521 (lines=37) @@
482
    /**
483
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
484
     */
485
    public function testSetStatusPublished()
486
    {
487
        $this->loggerMock->expects($this->once())->method('logCall');
488
489
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
490
        $this->persistenceHandlerMock
491
            ->expects($this->once())
492
            ->method('contentHandler')
493
            ->will($this->returnValue($innerHandlerMock));
494
495
        $innerHandlerMock
496
            ->expects($this->once())
497
            ->method('setStatus')
498
            ->with(2, VersionInfo::STATUS_PUBLISHED, 1)
499
            ->will($this->returnValue(true));
500
501
        $this->cacheMock
502
            ->expects($this->at(0))
503
            ->method('clear')
504
            ->with('content', 2, 1)
505
            ->will($this->returnValue(null));
506
507
        $this->cacheMock
508
            ->expects($this->at(1))
509
            ->method('clear')
510
            ->with('content', 2, ContentHandler::PUBLISHED_VERSION)
511
            ->will($this->returnValue(null));
512
513
        $this->cacheMock
514
            ->expects($this->at(2))
515
            ->method('clear')
516
            ->with('content', 'info', 2)
517
            ->will($this->returnValue(null));
518
519
        $handler = $this->persistenceCacheHandler->contentHandler();
520
        $handler->setStatus(2, VersionInfo::STATUS_PUBLISHED, 1);
521
    }
522
523
    /**
524
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::updateMetadata