Completed
Branch FET-10486-add-timestamp-checki... (611b15)
by
unknown
136:24 queued 121:17
created

TicketSelector::submitTicketSelectionsForEventId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace EventEspresso\Codeception\helpers;
3
4
use Page\TicketSelector as TicketSelectorElements;
5
6
/**
7
 * Trait TicketSelector
8
 * Helper actions for the ticket selector.
9
 *
10
 * @package EventEspresso\Codeception\helpers
11
 */
12
trait TicketSelector
13
{
14
15
    /**
16
     * Use to select a quantity from the first ticket for the given event (so this can be used on a event archive page).
17
     * @param int|string $event_id
18
     * @param int|string $quantity
19
     */
20
    public function selectQuantityOfFirstTicketForEventId($event_id, $quantity = 1)
21
    {
22
        $this->actor()->selectOption(TicketSelectorElements::ticketOptionByEventIdSelector($event_id), $quantity);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
23
    }
24
25
26
    /**
27
     * Used to submit the ticket selection for the given event id (so this can be used on an event archive page).
28
     * @param int|string $event_id
29
     */
30
    public function submitTicketSelectionsForEventId($event_id)
31
    {
32
        $this->actor()->click(TicketSelectorElements::ticketSelectionSubmitSelectorByEventId($event_id));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
33
    }
34
}