/** * @test */ public function shouldSecureOnlyChangedFields() { $card = new CreditCard(); $card->setNumber('1234'); $card->secure(); //guard $this->assertNull($this->readAttribute($card, 'number')); $this->assertInstanceOf('Payum\\Core\\Security\\SensitiveValue', $this->readAttribute($card, 'securedNumber')); $card->setNumber('John Doe'); $card->secure(); $this->assertNull($this->readAttribute($card, 'holder')); $this->assertInstanceOf('Payum\\Core\\Security\\SensitiveValue', $this->readAttribute($card, 'securedHolder')); $this->assertNull($this->readAttribute($card, 'number')); $this->assertInstanceOf('Payum\\Core\\Security\\SensitiveValue', $this->readAttribute($card, 'securedNumber')); }