Code Duplication    Length = 11-13 lines in 5 locations

src/OroCRM/Bundle/ContactBundle/Tests/Functional/API/RestContactEmailApiTest.php 2 locations

@@ 40-51 (lines=12) @@
37
        $this->assertNotEmpty($contact['id']);
38
    }
39
40
    public function testCreateSecondPrimaryEmail()
41
    {
42
        $contact = $this->getReference('Contact_Brenda');
43
        $content = json_encode([
44
            'contactId' => $contact->getId(),
45
            'email' =>'[email protected]',
46
            'primary' => true
47
        ]);
48
49
        $this->client->request('POST', $this->getUrl('oro_api_post_contact_email'), [], [], [], $content);
50
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
51
    }
52
53
    public function testEmptyContactId()
54
    {
@@ 64-74 (lines=11) @@
61
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
62
    }
63
64
    public function testEmptyEmail()
65
    {
66
        $contact = $this->getReference('Contact_Brenda');
67
        $content = json_encode([
68
            'contactId' => $contact->getId(),
69
            'primary' => true
70
        ]);
71
72
        $this->client->request('POST', $this->getUrl('oro_api_post_contact_email'), [], [], [], $content);
73
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
74
    }
75
76
    public function testDeleteEmailForbidden()
77
    {

src/OroCRM/Bundle/ContactBundle/Tests/Functional/API/RestContactPhoneApiTest.php 2 locations

@@ 41-53 (lines=13) @@
38
        $this->assertNotEmpty($contact['id']);
39
    }
40
41
    public function testCreateSecondPrimaryPhone()
42
    {
43
        $contact = $this->getReference('Contact_'. LoadContactEntitiesData::THIRD_ENTITY_NAME);
44
45
        $content = json_encode([
46
            'contactId' => $contact->getId(),
47
            'phone' =>'[email protected]',
48
            'primary' => true
49
        ]);
50
51
        $this->client->request('POST', $this->getUrl('oro_api_post_contact_phone'), [], [], [], $content);
52
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
53
    }
54
55
    public function testEmptyContactId()
56
    {
@@ 66-76 (lines=11) @@
63
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
64
    }
65
66
    public function testEmptyPhone()
67
    {
68
        $contact = $this->getReference('Contact_'. LoadContactEntitiesData::THIRD_ENTITY_NAME);
69
        $content = json_encode([
70
            'contactId' => $contact->getId(),
71
            'primary' => true
72
        ]);
73
74
        $this->client->request('POST', $this->getUrl('oro_api_post_contact_phone'), [], [], [], $content);
75
        $this->getJsonResponseContent($this->client->getResponse(), Codes::HTTP_BAD_REQUEST);
76
    }
77
78
    public function testDeletePhoneForbidden()
79
    {

src/OroCRM/Bundle/TaskBundle/Tests/Functional/Controller/Api/Rest/TaskControllerACLTest.php 1 location

@@ 101-113 (lines=13) @@
98
    /**
99
     * @depends testCreate
100
     */
101
    public function testPut()
102
    {
103
        $updatedTask = ['subject' => 'Updated subject'];
104
        $this->client->request(
105
            'PUT',
106
            $this->getUrl('orocrm_api_put_task', ['id' => self::$taskId]),
107
            $updatedTask,
108
            [],
109
            $this->generateWsseAuthHeader(self::USER_NAME, self::USER_PASSWORD)
110
        );
111
        $result = $this->client->getResponse();
112
        $this->assertJsonResponseStatusCodeEquals($result, 403);
113
    }
114
115
    /**
116
     * @depends testCreate