Conditions | 1 |
Paths | 1 |
Total Lines | 82 |
Code Lines | 57 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
76 | public function testEmailIsSentUponStepCheckoutCompletion() |
||
77 | { |
||
78 | $self = $this; |
||
79 | $this->useTestTheme( |
||
80 | dirname(__FILE__), |
||
81 | 'testtheme', |
||
82 | function () use ($self) { |
||
83 | $page = $self->get("checkout/"); |
||
84 | $self->assertEquals( |
||
85 | 200, |
||
86 | $page->getStatusCode(), |
||
87 | "contact details page should load" |
||
88 | ); |
||
89 | |||
90 | // contact form |
||
91 | $page = $self->submitForm("CheckoutForm_ContactDetailsForm", "action_checkoutSubmit", [ |
||
92 | 'CustomerDetailsCheckoutComponent_FirstName' => 'Joe', |
||
93 | 'CustomerDetailsCheckoutComponent_Surname' => 'Bloggs', |
||
94 | 'CustomerDetailsCheckoutComponent_Email' => '[email protected]' |
||
95 | ]); |
||
96 | $self->assertEquals( |
||
97 | 200, |
||
98 | $page->getStatusCode(), |
||
99 | "enter contact details page should load" |
||
100 | ); |
||
101 | |||
102 | // Shipping Address form |
||
103 | $page = $self->submitForm("CheckoutForm_ShippingAddressForm", "action_setshippingaddress", [ |
||
104 | 'ShippingAddressCheckoutComponent_Country' => 'AU', |
||
105 | 'ShippingAddressCheckoutComponent_Address' => '201-203 BROADWAY AVE', |
||
106 | 'ShippingAddressCheckoutComponent_AddressLine2' => 'U 235', |
||
107 | 'ShippingAddressCheckoutComponent_City' => 'WEST BEACH', |
||
108 | 'ShippingAddressCheckoutComponent_State' => 'South Australia', |
||
109 | 'ShippingAddressCheckoutComponent_PostalCode' => '5024', |
||
110 | 'ShippingAddressCheckoutComponent_Phone' => '', |
||
111 | 'SeperateBilling' => false |
||
112 | |||
113 | ]); |
||
114 | $self->assertEquals( |
||
115 | 200, |
||
116 | $page->getStatusCode(), |
||
117 | "payment methods page should load" |
||
118 | ); |
||
119 | |||
120 | $self->assertStringContainsString( |
||
121 | "CheckoutForm_PaymentMethodForm_PaymentMethod_Manual", |
||
122 | $page->getBody(), |
||
123 | "Manual payment method available" |
||
124 | ); |
||
125 | |||
126 | $self->assertStringContainsString( |
||
127 | "You will be notified of the bank account details", |
||
128 | $page->getBody(), |
||
129 | "Bank Account Message presented during the payment method section" |
||
130 | ); |
||
131 | |||
132 | // Payment Method can be manual |
||
133 | $page = $self->submitForm("CheckoutForm_PaymentMethodForm", "action_setpaymentmethod", [ |
||
134 | 'PaymentMethod' => 'Manual', |
||
135 | ]); |
||
136 | $self->assertEquals( |
||
137 | 200, |
||
138 | $page->getStatusCode(), |
||
139 | "Payment Method set. The summary page should load." |
||
140 | ); |
||
141 | |||
142 | // Summary |
||
143 | $page = $self->submitForm("PaymentForm_ConfirmationForm", "action_checkoutSubmit", [ |
||
144 | 'PaymentForm_ConfirmationForm_Notes' => 'Test', |
||
145 | ]); |
||
146 | $self->assertEquals( |
||
147 | 200, |
||
148 | $page->getStatusCode(), |
||
149 | "enter summary page should load" |
||
150 | ); |
||
151 | $self->assertStringContainsString( |
||
152 | 'XX-3456-7891011-XX', |
||
153 | $page->getBody(), |
||
154 | "Account Page contains bank deposit instructions" |
||
155 | ); |
||
156 | $self->assertEmailSent( |
||
157 | '[email protected]' |
||
158 | ); |
||
163 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..