/**
  * @group current
  * @group 4710
  */
 function test_set_line_items_taxable()
 {
     $t = $this->new_typical_transaction(array('taxable_tickets' => 0));
     EEH_Line_Item::add_unrelated_item($t->total_line_item(), 'Excempt Line Item', 1, 'Description', 1, false, 'exemptme');
     $reg_line_items = EEH_Line_Item::get_descendants_of_type($t->total_line_item(), EEM_Line_Item::type_line_item);
     foreach ($reg_line_items as $line_item) {
         $this->assertFalse($line_item->is_taxable(), print_r($line_item->model_field_array(), true));
     }
     EEH_Line_Item::set_line_items_taxable($t->total_line_item(), true, 'exemptme');
     foreach ($reg_line_items as $line_item) {
         if ($line_item->code() == 'exemptme') {
             $this->assertFalse($line_item->is_taxable(), print_r($line_item->model_field_array(), true));
         } else {
             $this->assertTrue($line_item->is_taxable(), print_r($line_item->model_field_array(), true));
         }
     }
 }
 /**
  * Makes all the line items which are children of $line_item taxable (or not).
  * Does NOT save the line items
  * @param EE_Line_Item $line_item
  * @param string $code_substring_for_whitelist if this string is part of the line item's code
  *  it will be whitelisted (ie, except from becoming taxable)
  * @param boolean $taxable
  */
 public static function set_line_items_taxable(EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null)
 {
     if ($code_substring_for_whitelist !== null) {
         $whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
     } else {
         $whitelisted = false;
     }
     if ($line_item->is_line_item() && !$whitelisted) {
         $line_item->set_is_taxable($taxable);
     }
     foreach ($line_item->children() as $child_line_item) {
         EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
     }
 }