Code Duplication    Length = 8-9 lines in 3 locations

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

@@ 33-41 (lines=9) @@
30
     * @Given /^I should be on the (teamspeak) instance creation page for "([^""]*)"$/
31
     * @Given /^I should still be on the (teamspeak) instance creation page for "([^""]*)"$/
32
     */
33
    public function iShouldBeOnTheVoipPage($type, $value)
34
    {
35
        $parts   = explode('@', $value);
36
        $machine = $this->findOneBy('machine', array('username' => $parts[0]));
37
        $server  = $this->findOneBy($type, array('machine' => $machine->getId()));
38
39
        $this->assertSession()->addressEquals($this->generatePageUrl($type . ' instance creation', array('serverId' => $server->getId())));
40
        $this->assertStatusCodeEquals(200);
41
    }
42
43
    /**
44
     * @Given /^I am on the page of (teamspeak) instance "([^""]*)"$/
@@ 91-98 (lines=8) @@
88
     * @Then /^I should be on the page of (teamspeak) instance "([^""]*)"$/
89
     * @Then /^I should still be on the page of (teamspeak) instance "([^""]*)"$/
90
     */
91
    public function iShouldBeOnTheInstancePageByName($type, $name)
92
    {
93
        $type = str_replace(' ', '_', $type);
94
        $resource = $this->findOneBy('instance', array('name' => $name), $type);
95
96
        $this->assertSession()->addressEquals($this->generatePageUrl(sprintf('%s_instance_show', $type), array('id' => $resource->getId(), 'serverId' => $resource->getServer()->getId())));
97
        $this->assertStatusCodeEquals(200);
98
    }
99
100
    /**
101
     * @Given /^I am on the (teamspeak) "([^""]*)" instance index$/
@@ 116-124 (lines=9) @@
113
    /**
114
     * @Then /^I should be on the (teamspeak) "([^"]*)" instance index$/
115
     */
116
    public function iShouldBeOnTheInstanceIndexPage($type, $value)
117
    {
118
        $parts   = explode('@', $value);
119
        $machine = $this->findOneBy('machine', array('username' => $parts[0]));
120
        $server  = $this->findOneBy($type, array('machine' => $machine->getId()));
121
122
        $this->assertSession()->addressEquals($this->generatePageUrl(sprintf('dedipanel_%s_instance_index', $type), array('serverId' => $server->getId())));
123
        $this->assertStatusCodeEquals(200);
124
    }
125
126
    /**
127
     * @Given /^I am (building|viewing|editing) (teamspeak) "([^""]*)"$/