public function testBuildForm() { // test encrypted password $encPassword = base64_encode('test'); $this->encryptor->expects($this->once())->method('encryptData')->will($this->returnValue($encPassword)); $form = $this->factory->create($this->formType); $form->submit('test'); $this->assertEquals($encPassword, $form->getData()); // test empty password with old password defined $form = $this->factory->create($this->formType, 'test'); $form->submit(''); $this->assertEquals('test', $form->getData()); }