/**
  * @dataProvider data_purchase_item_is_promotion
  * @covers Jam_Behavior_Promotable_Brand_Purchase::purchase_item_is_promotion
  */
 public function test_purchase_item_is_promotion($reference_model, $promotion, $expected)
 {
     $item = Jam::build('purchase_item_promotion', array('reference_model' => $reference_model));
     $this->assertEquals($expected, Jam_Behavior_Promotable_Brand_Purchase::purchase_item_is_promotion($item, $promotion));
 }
Example #2
0
 /**
  * Check if purchase item's reference is one of the given promotions
  * @param  Model_Purchase_Item $item
  * @param  string|array              $promotion
  * @return boolean
  */
 public static function purchase_item_is_promotion(Model_Purchase_Item $item, $promotion)
 {
     $model_names = Jam_Behavior_Promotable_Brand_Purchase::promotion_model_names($promotion);
     return in_array($item->reference_model, $model_names);
 }