Code Duplication    Length = 12-15 lines in 2 locations

Tests/Command/ORM/GeneratedRestControllerAssociationTest.php 1 location

@@ 72-86 (lines=15) @@
69
        $this->assertEquals($this->owner, $car->getCarOwner());
70
    }
71
72
    public function testPostWithNewAssociation() {
73
        $this->client->request('POST', '/cars.json', array(), array(), array(), json_encode(array(
74
            'name'=>'Toyota',
75
            'plateNumber'=>'BBC 234',
76
            'carOwner' => array(
77
                'name'=>'Terry'
78
            ),
79
        )));
80
        $this->assertEquals("201", $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent());
81
        $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car');
82
        $record = json_decode($this->client->getResponse()->getContent(), true);
83
        /** @var Car $car */
84
        $car = $repo->find($record['id']);
85
        $this->assertEquals('Terry', $car->getCarOwner()->getName());
86
    }
87
88
    public function testPostWithNoAssociation() {
89
        $this->client->request('POST', '/cars.json', array(), array(), array(), json_encode(array(

Tests/Command/ORM/GeneratedRestControllerTest.php 1 location

@@ 122-133 (lines=12) @@
119
        $this->assertEquals('ZZ1267', $record['plateNumber']);
120
    }
121
122
    public function testPostActionWithJMSGroup() {
123
        $this->client->request('POST', '/cars.json', array(), array(), array(), json_encode(array(
124
            'name'=>'BMW',
125
            'plateNumber'=>'ZZ1267',
126
            'password'=>'xxx',
127
        )));
128
        $this->assertEquals("201", $this->client->getResponse()->getStatusCode());
129
        $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car');
130
        $record = json_decode($this->client->getResponse()->getContent(), true);
131
        $this->assertArrayNotHasKey('password', $record);
132
        $this->assertEquals('xxx', $repo->find($record['id'])->getPassword());
133
    }
134
135
    public function testPostActionWithError() {
136
        $this->client->request('POST', '/cars.json', array(), array(), array(), json_encode(array(