not->toBeFalse(); $content = (string)$content; $start = strpos($content, 'public function addOrderItemLines'); $end = strpos($content, 'public function addOrderItemLine(', (int)$start + 1); expect($start)->not->toBeFalse(); expect($end)->not->toBeFalse(); expect($end)->toBeGreaterThan($start); $block = substr($content, (int)$start, (int)$end - (int)$start); // The aggregate TotDiscount line is only added when neither itemized discounts // nor a customer-level e-conomic discount is in effect. The customer discount // (e.g. bug #11 customer 35131752 "kd" 15%) is applied at the line level instead. expect($block) ->toContain('if (!$use_itemized_discounts && $customer_discount_percentage === 0 && $total_discount > 0)') ->toContain('self::addProductDiscountLine($total_discount'); });