Code Duplication    Length = 38-42 lines in 2 locations

src/OroCRM/Bundle/SalesBundle/Tests/Selenium/WorkflowTest.php 2 locations

@@ 27-68 (lines=42) @@
24
        'region' => 'New York'
25
    );
26
27
    public function testLeadWorkflowAsWon()
28
    {
29
        $login = $this->login();
30
31
        $leadName = $this->createLead($this->address);
32
        $accountName = $this->createAccount();
33
        $customer = $this->createB2BCustomer($accountName);
34
35
        /** @var SalesFunnels $login */
36
        $id = $login->openSalesFunnels('OroCRM\Bundle\SalesBundle')
37
            ->assertTitle('All - Sales Processes - Sales')
38
            ->startFromLead()
39
            ->assertTitle('New Sales Process - Sales Processes')
40
            ->selectEntity('Lead', $leadName)
41
            ->submit()
42
            ->openWorkflow('OroCRM\Bundle\SalesBundle')
43
            ->checkStep('New Lead')
44
            ->qualify()
45
            ->setB2BCustomer($customer)
46
            ->submit()
47
            ->checkStep('New Opportunity')
48
            ->develop()
49
            ->setBudget('100')
50
            ->setProbability('100')
51
            ->setCustomerNeed('Some customer need')
52
            ->setSolution('Some solution')
53
            ->submit()
54
            ->checkStep('Developed Opportunity')
55
            ->closeAsWon()
56
            ->setCloseRevenue('100')
57
            ->submit()
58
            ->checkStep('Won Opportunity')
59
            ->getId();
60
61
        /** @var Opportunities $login*/
62
        $login->openOpportunities('OroCRM\Bundle\SalesBundle')
63
            ->filterBy('Opportunity name', $leadName)
64
            ->open(array($leadName))
65
            ->checkStatus('Won');
66
67
        return $id;
68
    }
69
70
    public function testLeadWorkflowAsLost()
71
    {
@@ 70-107 (lines=38) @@
67
        return $id;
68
    }
69
70
    public function testLeadWorkflowAsLost()
71
    {
72
        $login = $this->login();
73
74
        $leadName = $this->createLead($this->address);
75
        $accountName = $this->createAccount();
76
        $customer = $this->createB2BCustomer($accountName);
77
78
        /** @var SalesFunnels $login */
79
        $login->openSalesFunnels('OroCRM\Bundle\SalesBundle')
80
            ->assertTitle('All - Sales Processes - Sales')
81
            ->startFromLead()
82
            ->assertTitle('New Sales Process - Sales Processes')
83
            ->selectEntity('Lead', $leadName)
84
            ->submit()
85
            ->openWorkflow('OroCRM\Bundle\SalesBundle')
86
            ->checkStep('New Lead')
87
            ->qualify()
88
            ->setB2BCustomer($customer)
89
            ->submit()
90
            ->checkStep('New Opportunity')
91
            ->develop()
92
            ->setBudget('100')
93
            ->setProbability('100')
94
            ->setCustomerNeed('Some customer need')
95
            ->setSolution('Some solution')
96
            ->submit()
97
            ->checkStep('Developed Opportunity')
98
            ->closeAsLost()
99
            ->setCloseReason('Cancelled')
100
            ->submit()
101
            ->checkStep('Lost Opportunity');
102
        /** @var  Opportunities $login */
103
        $login->openOpportunities('OroCRM\Bundle\SalesBundle')
104
            ->filterBy('Opportunity name', $leadName)
105
            ->open(array($leadName))
106
            ->checkStatus('Lost');
107
    }
108
109
    /**
110
     * @param $funnelId