public function testFilterSettingsAccessors() { $email = new SendGrid\Email(); $filters = array("filter_1" => array("settings" => array("enable" => 1, "setting_1" => "setting_val_1")), "filter_2" => array("settings" => array("enable" => 0, "setting_2" => "setting_val_2", "setting_3" => "setting_val_3")), "filter_3" => array("settings" => array("enable" => 0, "setting_4" => "setting_val_4", "setting_5" => "setting_val_5"))); $email->setFilterSettings($filters); $header = $email->getSmtpapiHeaders(); $this->assertEquals(count($filters), count($header['filters'])); $this->assertEquals($filters, $header['filters']); //the addFilter appends to the filter list $email->addFilterSetting("filter_4", "enable", 0); $email->addFilterSetting("filter_4", "setting_6", "setting_val_6"); $email->addFilterSetting("filter_4", "setting_7", "setting_val_7"); $filters["filter_4"] = array("settings" => array("enable" => 0, "setting_6" => "setting_val_6", "setting_7" => "setting_val_7")); $header = $email->getSmtpapiHeaders(); $this->assertEquals($filters, $header['filters']); }