Completed
Push — master ( c76232...ce4950 )
by Matthew
27:26 queued 01:28
created

RunManagerTest::testGetRunClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Dtc\QueueBundle\Tests\Manager;
4
5
use Dtc\QueueBundle\Exception\UnsupportedException;
6
use Dtc\QueueBundle\Manager\RunManager;
7
use Dtc\QueueBundle\Model\Run;
8
use PHPUnit\Framework\TestCase;
9
10
class RunManagerTest extends TestCase
11
{
12
    public function testGetRunClass()
13
    {
14
        $runManager = new RunManager(Run::class);
15
        self::assertEquals(Run::class, $runManager->getRunClass());
16
    }
17
18
    public function testSetRunClass()
19
    {
20
        $runManager = new RunManager(Run::class);
21
        self::assertEquals(Run::class, $runManager->getRunClass());
22
        $runManager->setRunClass(\Dtc\QueueBundle\Entity\Run::class);
23
        self::assertEquals(\Dtc\QueueBundle\Entity\Run::class, $runManager->getRunClass());
24
    }
25
26 View Code Duplication
    public function testPruneArchiveRuns()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        $runManager = new RunManager(Run::class);
29
30
        $failure = false;
31
        try {
32
            $runManager->pruneArchivedRuns(new \DateTime());
33
            $failure = true;
34
        } catch (UnsupportedException $exception) {
35
            self::assertNotNull($exception);
36
        }
37
        self::assertFalse($failure);
38
    }
39
40 View Code Duplication
    public function testPruneStalledRuns()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $runManager = new RunManager(Run::class);
43
44
        $failure = false;
45
        try {
46
            $runManager->pruneStalledRuns();
47
            $failure = true;
48
        } catch (UnsupportedException $exception) {
49
            self::assertNotNull($exception);
50
        }
51
        self::assertFalse($failure);
52
    }
53
}
54