Code Duplication    Length = 12-12 lines in 3 locations

module/Core/test/Service/ShortUrl/DeleteShortUrlServiceTest.php 3 locations

@@ 61-72 (lines=12) @@
58
    /**
59
     * @test
60
     */
61
    public function deleteByShortCodeDeletesUrlWhenThresholdIsReachedButExplicitlyIgnored()
62
    {
63
        $service = $this->createService();
64
65
        $remove = $this->em->remove(Argument::type(ShortUrl::class))->willReturn(null);
66
        $flush = $this->em->flush()->willReturn(null);
67
68
        $service->deleteByShortCode('abc123', true);
69
70
        $remove->shouldHaveBeenCalledTimes(1);
71
        $flush->shouldHaveBeenCalledTimes(1);
72
    }
73
74
    /**
75
     * @test
@@ 77-88 (lines=12) @@
74
    /**
75
     * @test
76
     */
77
    public function deleteByShortCodeDeletesUrlWhenThresholdIsReachedButCheckIsDisabled()
78
    {
79
        $service = $this->createService(false);
80
81
        $remove = $this->em->remove(Argument::type(ShortUrl::class))->willReturn(null);
82
        $flush = $this->em->flush()->willReturn(null);
83
84
        $service->deleteByShortCode('abc123');
85
86
        $remove->shouldHaveBeenCalledTimes(1);
87
        $flush->shouldHaveBeenCalledTimes(1);
88
    }
89
90
    /**
91
     * @test
@@ 93-104 (lines=12) @@
90
    /**
91
     * @test
92
     */
93
    public function deleteByShortCodeDeletesUrlWhenThresholdIsNotReached()
94
    {
95
        $service = $this->createService(true, 100);
96
97
        $remove = $this->em->remove(Argument::type(ShortUrl::class))->willReturn(null);
98
        $flush = $this->em->flush()->willReturn(null);
99
100
        $service->deleteByShortCode('abc123');
101
102
        $remove->shouldHaveBeenCalledTimes(1);
103
        $flush->shouldHaveBeenCalledTimes(1);
104
    }
105
106
    private function createService(bool $checkVisitsThreshold = true, int $visitsThreshold = 5): DeleteShortUrlService
107
    {