Code Duplication    Length = 8-9 lines in 3 locations

src/DP/Core/CoreBundle/Behat/ServerContext.php 3 locations

@@ 40-48 (lines=9) @@
37
     * @Given /^I should be on the (teamspeak) instance creation page for "([^""]*)"$/
38
     * @Given /^I should still be on the (teamspeak) instance creation page for "([^""]*)"$/
39
     */
40
    public function iShouldBeOnTheVoipPage($type, $value)
41
    {
42
        $parts   = explode('@', $value);
43
        $machine = $this->findOneBy('machine', array('username' => $parts[0]));
44
        $server  = $this->findOneBy($type, array('machine' => $machine->getId()));
45
46
        $this->assertSession()->addressEquals($this->generatePageUrl($type . ' instance creation', array('serverId' => $server->getId())));
47
        $this->assertStatusCodeEquals(200);
48
    }
49
50
    /**
51
     * @Given /^I am on the page of (teamspeak) instance "([^""]*)"$/
@@ 98-105 (lines=8) @@
95
     * @Then /^I should be on the page of (teamspeak) instance "([^""]*)"$/
96
     * @Then /^I should still be on the page of (teamspeak) instance "([^""]*)"$/
97
     */
98
    public function iShouldBeOnTheInstancePageByName($type, $name)
99
    {
100
        $type = str_replace(' ', '_', $type);
101
        $resource = $this->findOneBy('instance', array('name' => $name), $type);
102
103
        $this->assertSession()->addressEquals($this->generatePageUrl(sprintf('%s_instance_show', $type), array('id' => $resource->getId(), 'serverId' => $resource->getServer()->getId())));
104
        $this->assertStatusCodeEquals(200);
105
    }
106
107
    /**
108
     * @Given /^I am on the (teamspeak) "([^""]*)" instance index$/
@@ 123-131 (lines=9) @@
120
    /**
121
     * @Then /^I should be on the (teamspeak) "([^"]*)" instance index$/
122
     */
123
    public function iShouldBeOnTheInstanceIndexPage($type, $value)
124
    {
125
        $parts   = explode('@', $value);
126
        $machine = $this->findOneBy('machine', array('username' => $parts[0]));
127
        $server  = $this->findOneBy($type, array('machine' => $machine->getId()));
128
129
        $this->assertSession()->addressEquals($this->generatePageUrl(sprintf('dedipanel_%s_instance_index', $type), array('serverId' => $server->getId())));
130
        $this->assertStatusCodeEquals(200);
131
    }
132
133
    /**
134
     * @Given /^I am (building|viewing|editing) (teamspeak) "([^""]*)"$/