コード例 #1
0
 public function testSetPaymentMethodFilter()
 {
     $this->assertFalse($this->object->setPaymentMethodFilter(null));
     //can't be nothing
     $this->assertFalse($this->object->setPaymentMethodFilter(5));
     //can't be an int
     $list = array('One', 'Two', 'Three');
     $this->assertNull($this->object->setPaymentMethodFilter($list));
     $o = $this->object->getOptions();
     $this->assertArrayHasKey('PaymentMethod.1', $o);
     $this->assertEquals('One', $o['PaymentMethod.1']);
     $this->assertArrayHasKey('PaymentMethod.2', $o);
     $this->assertEquals('Two', $o['PaymentMethod.2']);
     $this->assertArrayHasKey('PaymentMethod.3', $o);
     $this->assertEquals('Three', $o['PaymentMethod.3']);
     $this->assertNull($this->object->setPaymentMethodFilter('Four'));
     //will cause reset
     $o2 = $this->object->getOptions();
     $this->assertArrayHasKey('PaymentMethod.1', $o2);
     $this->assertEquals('Four', $o2['PaymentMethod.1']);
     $this->assertArrayNotHasKey('PaymentMethod.2', $o2);
     $this->assertArrayNotHasKey('PaymentMethod.3', $o2);
     $this->object->resetPaymentMethodFilter();
     $o3 = $this->object->getOptions();
     $this->assertArrayNotHasKey('PaymentMethod.1', $o3);
 }