Code Duplication    Length = 18-21 lines in 3 locations

src/OroCRM/Bundle/MarketingListBundle/Tests/Unit/Model/MarketingListItemConnectorTest.php 1 location

@@ 93-113 (lines=21) @@
90
        $this->assertInstanceOf('\DateTime', $marketingListItem->getLastContactedAt());
91
    }
92
93
    public function testContactResultRow()
94
    {
95
        $entityId = 42;
96
        $marketingList = $this->getMockBuilder('OroCRM\Bundle\MarketingListBundle\Entity\MarketingList')
97
            ->disableOriginalConstructor()
98
            ->getMock();
99
        $marketingList->expects($this->once())
100
            ->method('getEntity')
101
            ->will($this->returnValue('\stdClass'));
102
        $this->doctrineHelper->expects($this->once())
103
            ->method('getSingleEntityIdentifierFieldName')
104
            ->with('\stdClass')
105
            ->will($this->returnValue('id'));
106
107
        $this->assertContactedExisting($marketingList, $entityId);
108
        $marketingListItem = $this->connector->contactResultRow($marketingList, array('id' => $entityId));
109
        $this->assertInstanceOf(
110
            'OroCRM\Bundle\MarketingListBundle\Entity\MarketingListItem',
111
            $marketingListItem
112
        );
113
    }
114
115
    /**
116
     * @expectedException \InvalidArgumentException

src/OroCRM/Bundle/MarketingListBundle/Tests/Unit/Provider/MarketingListProviderTest.php 2 locations

@@ 123-143 (lines=21) @@
120
     * @dataProvider queryBuilderDataProvider
121
     * @param string $type
122
     */
123
    public function testGetMarketingListEntitiesQueryBuilder($type)
124
    {
125
        $marketingList = $this->getMarketingList($type);
126
127
        $from = $this->getMockBuilder('Doctrine\ORM\Query\Expr\From')
128
            ->disableOriginalConstructor()
129
            ->getMock();
130
        $from->expects($this->once())
131
            ->method('getAlias')
132
            ->will($this->returnValue('alias'));
133
        $queryBuilder = $this->assertEntitiesQueryBuilder($marketingList, 'alias');
134
        $queryBuilder->expects($this->once())
135
            ->method('getDQLPart')
136
            ->with('from')
137
            ->will($this->returnValue([$from]));
138
139
        $this->assertInstanceOf(
140
            'Doctrine\ORM\QueryBuilder',
141
            $this->provider->getMarketingListEntitiesQueryBuilder($marketingList)
142
        );
143
    }
144
145
    /**
146
     * @dataProvider queryBuilderDataProvider
@@ 149-166 (lines=18) @@
146
     * @dataProvider queryBuilderDataProvider
147
     * @param string $type
148
     */
149
    public function testGetMarketingListEntitiesIterator($type)
150
    {
151
        $marketingList = $this->getMarketingList($type);
152
153
        $from = $this->getMockBuilder('Doctrine\ORM\Query\Expr\From')
154
            ->disableOriginalConstructor()
155
            ->getMock();
156
        $from->expects($this->once())
157
            ->method('getAlias')
158
            ->will($this->returnValue('alias'));
159
        $queryBuilder = $this->assertEntitiesQueryBuilder($marketingList, 'alias');
160
        $queryBuilder->expects($this->once())
161
            ->method('getDQLPart')
162
            ->with('from')
163
            ->will($this->returnValue([$from]));
164
165
        $this->assertInstanceOf('\Iterator', $this->provider->getMarketingListEntitiesIterator($marketingList));
166
    }
167
168
    /**
169
     * @param MarketingList $marketingList