Code Duplication    Length = 37-37 lines in 2 locations

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

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