Code Duplication    Length = 21-21 lines in 2 locations

src/Kunstmaan/FormBundle/Tests/AdminList/FormPageAdminListConfiguratorTest.php 1 location

@@ 44-64 (lines=21) @@
41
     *
42
     * @return \Doctrine\ORM\EntityManager
43
     */
44
    protected function getMockedEntityManager()
45
    {
46
        $emMock  = $this->createMock('\Doctrine\ORM\EntityManager', array('getRepository', 'getConfiguration', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
47
        $emMock->expects($this->any())
48
            ->method('getRepository')
49
            ->will($this->returnValue(new TestRepository()));
50
        $emMock->expects($this->any())
51
            ->method('getConfiguration')
52
            ->will($this->returnValue(new TestConfiguration()));
53
        $emMock->expects($this->any())
54
            ->method('getClassMetadata')
55
            ->will($this->returnValue((object) array('name' => 'aClass')));
56
        $emMock->expects($this->any())
57
            ->method('persist')
58
            ->will($this->returnValue(null));
59
        $emMock->expects($this->any())
60
            ->method('flush')
61
            ->will($this->returnValue(null));
62
63
        return $emMock;  // it tooks 13 lines to achieve mock!
64
    }
65
66
    public function testAdaptQueryBuilder()
67
    {

src/Kunstmaan/FormBundle/Tests/AdminList/FormSubmissionAdminListConfiguratorTest.php 1 location

@@ 43-63 (lines=21) @@
40
     *
41
     * @return \Doctrine\ORM\EntityManager
42
     */
43
    protected function getMockedEntityManager()
44
    {
45
        $emMock  = $this->createMock('\Doctrine\ORM\EntityManager', array('getRepository', 'getConfiguration', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
46
        $emMock->expects($this->any())
47
            ->method('getRepository')
48
            ->will($this->returnValue(new TestRepository()));
49
        $emMock->expects($this->any())
50
            ->method('getConfiguration')
51
            ->will($this->returnValue(new TestConfiguration()));
52
        $emMock->expects($this->any())
53
            ->method('getClassMetadata')
54
            ->will($this->returnValue((object) array('name' => 'aClass')));
55
        $emMock->expects($this->any())
56
            ->method('persist')
57
            ->will($this->returnValue(null));
58
        $emMock->expects($this->any())
59
            ->method('flush')
60
            ->will($this->returnValue(null));
61
62
        return $emMock;  // it tooks 13 lines to achieve mock!
63
    }
64
65
    public function testAdaptQueryBuilder()
66
    {