Code Duplication    Length = 37-37 lines in 2 locations

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

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