1 | <?php |
||
23 | class CreatePage extends BaseCreatePage implements CreatePageInterface |
||
24 | { |
||
25 | use NamesIt; |
||
26 | use SpecifiesItsCode; |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | public function addRule($ruleName) |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function selectRuleOption($option, $value, $multiple = false) |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function fillRuleOption($option, $value) |
||
50 | { |
||
51 | $this->getLastAddedCollectionItem('rules')->fillField($option, $value); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function addAction($actionName) |
||
58 | { |
||
59 | $this->getDocument()->clickLink('Add action'); |
||
60 | |||
61 | $this->selectActionOption('Type', $actionName); |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function selectActionOption($option, $value, $multiple = false) |
||
68 | { |
||
69 | $this->getLastAddedCollectionItem('actions')->find('named', array('select', $option))->selectOption($value, $multiple); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function fillActionOption($option, $value) |
||
76 | { |
||
77 | $this->getLastAddedCollectionItem('actions')->fillField($option, $value); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function fillUsageLimit($limit) |
||
87 | |||
88 | public function makeExclusive() |
||
92 | |||
93 | public function checkCouponBased() |
||
97 | |||
98 | public function checkChannel($name) |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function setStartsAt(\DateTime $dateTime) |
||
107 | { |
||
108 | $timestamp = $dateTime->getTimestamp(); |
||
109 | |||
110 | $this->getDocument()->fillField('sylius_promotion_startsAt_date', date('Y-m-d', $timestamp)); |
||
111 | $this->getDocument()->fillField('sylius_promotion_startsAt_time', date('H:i', $timestamp)); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function setEndsAt(\DateTime $dateTime) |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | protected function getDefinedElements() |
||
138 | |||
139 | /** |
||
140 | * @param string $collection |
||
141 | * |
||
142 | * @return NodeElement |
||
143 | */ |
||
144 | private function getLastAddedCollectionItem($collection) |
||
150 | } |
||
151 |