1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Oro\Bridge\CrmTask\Tests\Selenium; |
4
|
|
|
|
5
|
|
|
use Oro\Bundle\TestFrameworkBundle\Test\Selenium2TestCase; |
6
|
|
|
use OroCRM\Bundle\TaskBundle\Tests\Selenium\Pages\Task; |
7
|
|
|
use OroCRM\Bundle\ContactBundle\Tests\Selenium\Pages\Contacts; |
8
|
|
|
|
9
|
|
|
class ContactTaskActivityListTest extends Selenium2TestCase |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @return string |
13
|
|
|
*/ |
14
|
|
View Code Duplication |
public function testCreateContact() |
|
|
|
|
15
|
|
|
{ |
16
|
|
|
$contactName = 'Contact_'.mt_rand(); |
17
|
|
|
|
18
|
|
|
$login = $this->login(); |
19
|
|
|
/** @var Contacts $login */ |
20
|
|
|
$login->openContacts('OroCRM\Bundle\ContactBundle') |
21
|
|
|
->assertTitle('All - Contacts - Customers') |
22
|
|
|
->add() |
23
|
|
|
->assertTitle('Create Contact - Contacts - Customers') |
24
|
|
|
->setFirstName($contactName . '_first') |
25
|
|
|
->setLastName($contactName . '_last') |
26
|
|
|
->setOwner('admin') |
27
|
|
|
->setEmail($contactName . '@mail.com') |
28
|
|
|
->save(); |
29
|
|
|
|
30
|
|
|
return $contactName; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @depends testCreateContact |
35
|
|
|
* @param $contactName |
36
|
|
|
*/ |
37
|
|
View Code Duplication |
public function testAddTaskActivity($contactName) |
|
|
|
|
38
|
|
|
{ |
39
|
|
|
$subject = 'Tasks_' . mt_rand(); |
40
|
|
|
|
41
|
|
|
$login = $this->login(); |
42
|
|
|
/** @var Contacts $login */ |
43
|
|
|
$task = $login->openContacts('OroCRM\Bundle\ContactBundle') |
|
|
|
|
44
|
|
|
->filterBy('Email', $contactName . '@mail.com') |
45
|
|
|
->open([$contactName]) |
46
|
|
|
->runActionInGroup('Add task') |
47
|
|
|
->openTask('OroCRM\Bundle\TaskBundle'); |
48
|
|
|
|
49
|
|
|
/** @var Task $task */ |
50
|
|
|
$task |
51
|
|
|
->setSubject($subject) |
52
|
|
|
->setDescription($subject) |
53
|
|
|
->createTask() |
54
|
|
|
->assertMessage('Task created successfully') |
55
|
|
|
->verifyActivity('Task', $subject); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function testCloseWidgetWindow() |
59
|
|
|
{ |
60
|
|
|
$login = $this->login(); |
61
|
|
|
$login->closeWidgetWindow(); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.