Code Duplication    Length = 31-31 lines in 2 locations

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

@@ 586-616 (lines=31) @@
583
    /**
584
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::updateRole
585
     */
586
    public function testUpdateRole()
587
    {
588
        $this->loggerMock->expects($this->once())->method('logCall');
589
590
        $innerHandler = $this->getSPIUserHandlerMock();
591
        $this->persistenceHandlerMock
592
            ->expects($this->once())
593
            ->method('userHandler')
594
            ->will($this->returnValue($innerHandler));
595
596
        $innerHandler
597
            ->expects($this->once())
598
            ->method('updateRole')
599
            ->with($this->isInstanceOf(RoleUpdateStruct::class));
600
601
        $roleUpdateStruct = new RoleUpdateStruct();
602
        $roleUpdateStruct->id = 42;
603
604
        $this->cacheMock
605
            ->expects($this->once())
606
            ->method('clear')
607
            ->with('user', 'role', $roleUpdateStruct->id)
608
            ->will($this->returnValue(true));
609
610
        $this->cacheMock
611
            ->expects($this->never())
612
            ->method('getItem');
613
614
        $handler = $this->persistenceCacheHandler->userHandler();
615
        $handler->updateRole($roleUpdateStruct);
616
    }
617
618
    /**
619
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::updateRole
@@ 621-651 (lines=31) @@
618
    /**
619
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::updateRole
620
     */
621
    public function testUpdateRoleDraft()
622
    {
623
        $this->loggerMock->expects($this->once())->method('logCall');
624
625
        $innerHandler = $this->getSPIUserHandlerMock();
626
        $this->persistenceHandlerMock
627
            ->expects($this->once())
628
            ->method('userHandler')
629
            ->will($this->returnValue($innerHandler));
630
631
        $innerHandler
632
            ->expects($this->once())
633
            ->method('updateRole')
634
            ->with($this->isInstanceOf(RoleUpdateStruct::class));
635
636
        $roleUpdateStruct = new RoleUpdateStruct();
637
        $roleUpdateStruct->id = 42;
638
639
        $this->cacheMock
640
            ->expects($this->once())
641
            ->method('clear')
642
            ->with('user', 'role', $roleUpdateStruct->id)
643
            ->will($this->returnValue(true));
644
645
        $this->cacheMock
646
            ->expects($this->never())
647
            ->method('getItem');
648
649
        $handler = $this->persistenceCacheHandler->userHandler();
650
        $handler->updateRole($roleUpdateStruct);
651
    }
652
653
    /**
654
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole