Completed
Push — master ( 43fb10...664b94 )
by
unknown
12:57
created

ContactTaskActivityListTest::testAddTaskActivity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 20
Ratio 100 %

Importance

Changes 0
Metric Value
dl 20
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 1
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()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
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)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
38
    {
39
        $subject = 'Tasks_' . mt_rand();
40
41
        $login = $this->login();
42
        /** @var Contacts $login */
43
        $task = $login->openContacts('OroCRM\Bundle\ContactBundle')
0 ignored issues
show
Documentation Bug introduced by
The method openTask does not exist on object<OroCRM\Bundle\Con...Selenium\Pages\Contact>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
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