1 | <?php |
||
26 | class FeatureContext implements Context |
||
|
|||
27 | { |
||
28 | protected $engine; |
||
29 | |||
30 | protected $customer; |
||
31 | protected $price; |
||
32 | protected $action; |
||
33 | protected $charges; |
||
34 | protected $date; |
||
35 | |||
36 | /** |
||
37 | * Initializes context. |
||
38 | */ |
||
39 | public function __construct() |
||
43 | |||
44 | /** |
||
45 | * @Given /(\S+) (\S+) price is ([0-9.]+) (\w+) per (\w+)/ |
||
46 | */ |
||
47 | public function priceIs($target, $type, $sum, $currency, $unit) |
||
48 | { |
||
49 | $type = new Type(Type::ANY, $type); |
||
50 | $target = new Target(Target::ANY, $target); |
||
51 | $quantity = Quantity::create($unit, 0); |
||
52 | $sum = new Money($sum*100, new Currency($currency)); |
||
53 | $this->price = new SinglePrice(null, $type, $target, null, $quantity, $sum); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @Given /action is (\S+) (\w+) ([0-9.]+) (\S+)/ |
||
58 | */ |
||
59 | public function actionIs($target, $type, $amount, $unit) |
||
67 | |||
68 | /** |
||
69 | * @Given /formula is (.+)/ |
||
70 | */ |
||
71 | public function formulaIs($formula) |
||
75 | |||
76 | protected function getFormulaEngine() |
||
84 | |||
85 | /** |
||
86 | * @When /action date is ([0-9.-]+)/ |
||
87 | */ |
||
88 | public function actionDateIs($date) |
||
92 | |||
93 | /** |
||
94 | * @Then /(\w+) charge is $/ |
||
95 | */ |
||
96 | public function emptyCharge($numeral) |
||
100 | |||
101 | /** |
||
102 | * @Then /(\w+) charge is (\S+) ([0-9.]+) ([A-Z]{3})$/ |
||
103 | */ |
||
104 | public function chargeWithSum($numeral, $type = null, $sum = null, $currency = null) |
||
108 | |||
109 | /** |
||
110 | * @Then /(\w+) charge is (\S+) ([0-9.]+) ([A-Z]{3}) reason (.+)/ |
||
111 | */ |
||
112 | public function chargeWithReason($numeral, $type = null, $sum = null, $currency = null, $reason = null) |
||
116 | |||
117 | public function chargeIs($numeral, $type = null, $sum = null, $currency = null, $reason = null) |
||
125 | |||
126 | public function assertCharge($charge, $type, $sum, $currency, $reason) |
||
140 | |||
141 | protected $numerals = [ |
||
142 | 'first' => 1, |
||
143 | 'second' => 2, |
||
144 | 'third' => 3, |
||
145 | 'fourth' => 4, |
||
146 | 'fifth' => 5, |
||
147 | ]; |
||
148 | |||
149 | public function ensureNo($numeral) |
||
157 | } |
||
158 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.