Code Duplication    Length = 13-15 lines in 9 locations

src/Oro/Bundle/ContactBundle/Tests/Selenium/Pages/Contact.php 5 locations

@@ 136-150 (lines=15) @@
133
            ->byXpath("//*[@data-ftid='oro_contact_form_addresses_{$addressId}_primary']")->selected();
134
    }
135
136
    public function setAddressFirstName($value, $addressId = 0)
137
    {
138
        $addressFirstName = "//input[@data-ftid='oro_contact_form_addresses_{$addressId}_firstName']";
139
        if ($this->isElementPresent("//div[@role='dialog']")) {
140
            $addressFirstName = "//input[@data-ftid='oro_contact_address_form_firstName']";
141
        }
142
        $addressFirstName = $this->test->byXpath($addressFirstName);
143
        $this->test->moveto($addressFirstName);
144
145
        $addressFirstName->clear();
146
        $addressFirstName->value($value);
147
148
        return $this;
149
    }
150
151
    public function getAddressFirstName($addressId = 0)
152
    {
153
        $addressFirstName = $this->test
@@ 158-172 (lines=15) @@
155
        return $addressFirstName->attribute('value');
156
    }
157
158
    public function setAddressLastName($value, $addressId = 0)
159
    {
160
        $addressLastName = "//input[@data-ftid='oro_contact_form_addresses_{$addressId}_lastName']";
161
        if ($this->isElementPresent("//div[@role='dialog']")) {
162
            $addressLastName = "//input[@data-ftid='oro_contact_address_form_lastName']";
163
        }
164
        $addressLastName = $this->test->byXpath($addressLastName);
165
        $this->test->moveto($addressLastName);
166
167
        $addressLastName->clear();
168
        $addressLastName->value($value);
169
170
        return $this;
171
    }
172
173
    public function getAddressLastName($addressId = 0)
174
    {
175
        $addressLastName = $this->test
@@ 180-193 (lines=14) @@
177
        return $addressLastName->attribute('value');
178
    }
179
180
    public function setAddressStreet($value, $addressId = 0)
181
    {
182
        $street = "//input[@data-ftid='oro_contact_form_addresses_{$addressId}_street']";
183
        if ($this->isElementPresent("//div[@role='dialog']")) {
184
            $street = "//input[@data-ftid='oro_contact_address_form_street']";
185
        }
186
        $street = $this->test->byXpath($street);
187
        $this->test->moveto($street);
188
189
        $street->clear();
190
        $street->value($value);
191
192
        return $this;
193
    }
194
195
    public function getAddressStreet($addressId = 0)
196
    {
@@ 201-213 (lines=13) @@
198
        return $street->attribute('value');
199
    }
200
201
    public function setAddressCity($value, $addressId = 0)
202
    {
203
        $xpathCity = "//input[@data-ftid='oro_contact_form_addresses_{$addressId}_city']";
204
        if ($this->isElementPresent("//div[@role='dialog']")) {
205
            $xpathCity = "//input[@data-ftid='oro_contact_address_form_city']";
206
        }
207
        $city = $this->test->byXpath($xpathCity);
208
        $this->test->moveto($city);
209
210
        $city->clear();
211
        $city->value($value);
212
        return $this;
213
    }
214
215
    public function getAddressCity($addressId = 0)
216
    {
@@ 221-233 (lines=13) @@
218
        return $city->attribute('value');
219
    }
220
221
    public function setAddressPostalCode($value, $addressId = 0)
222
    {
223
        $xpathZipcode = "//input[@data-ftid='oro_contact_form_addresses_{$addressId}_postalCode']";
224
        if ($this->isElementPresent("//div[@role='dialog']")) {
225
            $xpathZipcode = "//input[@data-ftid='oro_contact_address_form_postalCode']";
226
        }
227
        $zipcode = $this->test->byXpath($xpathZipcode);
228
        $this->test->moveto($zipcode);
229
230
        $zipcode->clear();
231
        $zipcode->value($value);
232
        return $this;
233
    }
234
235
    public function getAddressPostalCode($addressId = 0)
236
    {

src/Oro/Bundle/SalesBundle/Tests/Selenium/Pages/Lead.php 4 locations

@@ 236-249 (lines=14) @@
233
            ->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_primary']")->selected();
234
    }
235
236
    public function setAddressFirstName($value, $addressId = 0)
237
    {
238
        $addressFirstName = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_firstName']";
239
        if ($this->isElementPresent("//div[@role='dialog']")) {
240
            $addressFirstName = "//input[@data-ftid='oro_sales_lead_address_form_firstName']";
241
        }
242
        $addressFirstName = $this->test->byXpath($addressFirstName);
243
        $this->test->moveto($addressFirstName);
244
245
        $addressFirstName->clear();
246
        $addressFirstName->value($value);
247
248
        return $this;
249
    }
250
251
    public function getAddressFirstName($addressId = 0)
252
    {
@@ 259-272 (lines=14) @@
256
        return $addressFirstName->attribute('value');
257
    }
258
259
    public function setAddressLastName($value, $addressId = 0)
260
    {
261
        $addressLastName = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_lastName']";
262
        if ($this->isElementPresent("//div[@role='dialog']")) {
263
            $addressLastName = "//input[@data-ftid='oro_sales_lead_address_form_lastName']";
264
        }
265
        $addressLastName = $this->test->byXpath($addressLastName);
266
        $this->test->moveto($addressLastName);
267
268
        $addressLastName->clear();
269
        $addressLastName->value($value);
270
271
        return $this;
272
    }
273
274
    public function getAddressLastName($addressId = 0)
275
    {
@@ 281-294 (lines=14) @@
278
        return $addressLastName->attribute('value');
279
    }
280
281
    public function setAddressStreet($value, $addressId = 0)
282
    {
283
        $street = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_street']";
284
        if ($this->isElementPresent("//div[@role='dialog']")) {
285
            $street = "//input[@data-ftid='oro_sales_lead_address_form_street']";
286
        }
287
        $street = $this->test->byXpath($street);
288
        $this->test->moveto($street);
289
290
        $street->clear();
291
        $street->value($value);
292
293
        return $this;
294
    }
295
296
    public function getAddressStreet($addressId = 0)
297
    {
@@ 324-337 (lines=14) @@
321
        return $city->attribute('value');
322
    }
323
324
    public function setAddressPostalCode($value, $addressId = 0)
325
    {
326
        $xpathZipcode = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_postalCode']";
327
        if ($this->isElementPresent("//div[@role='dialog']")) {
328
            $xpathZipcode = "//input[@data-ftid='oro_sales_lead_address_form_postalCode']";
329
        }
330
        $zipcode = $this->test->byXpath($xpathZipcode);
331
        $this->test->moveto($zipcode);
332
333
        $zipcode->clear();
334
        $zipcode->value($value);
335
336
        return $this;
337
    }
338
339
    public function getAddressPostalCode($addressId = 0)
340
    {