Skip to content

Commit 2f76bd1

Browse files
committed
Fix tests for "Fix array_push param order for form filters"
1 parent 5c0bfda commit 2f76bd1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tests/ZfcUserTest/Form/ChangeEmailFilterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function testConstruct()
2121
$this->assertArrayHasKey('newIdentity', $inputs);
2222
$this->assertArrayHasKey('newIdentityVerify', $inputs);
2323

24-
$this->assertEquals(0, $inputs['identity']->getValidatorChain()->count());
24+
$validators = $inputs['identity']->getValidatorChain()->getValidators();
25+
$this->assertArrayHasKey('instance', $validators[0]);
26+
$this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']);
2527
}
2628

2729
/**
@@ -32,7 +34,7 @@ public function testConstructIdentityEmail($onlyEmail)
3234
$options = $this->getMock('ZfcUser\Options\ModuleOptions');
3335
$options->expects($this->once())
3436
->method('getAuthIdentityFields')
35-
->will($this->returnValue(array('email')));
37+
->will($this->returnValue(($onlyEmail) ? array('email') : array('username')));
3638

3739
$validator = $this->getMockBuilder('ZfcUser\Validator\NoRecordExists')->disableOriginalConstructor()->getMock();
3840
$filter = new Filter($options, $validator);

tests/ZfcUserTest/Form/ChangePasswordFilterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function testConstruct()
2121
$this->assertArrayHasKey('newCredential', $inputs);
2222
$this->assertArrayHasKey('newCredentialVerify', $inputs);
2323

24-
$this->assertEquals(0, $inputs['identity']->getValidatorChain()->count());
24+
$validators = $inputs['identity']->getValidatorChain()->getValidators();
25+
$this->assertArrayHasKey('instance', $validators[0]);
26+
$this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']);
2527
}
2628

2729
/**
@@ -32,7 +34,7 @@ public function testConstructIdentityEmail($onlyEmail)
3234
$options = $this->getMock('ZfcUser\Options\ModuleOptions');
3335
$options->expects($this->once())
3436
->method('getAuthIdentityFields')
35-
->will($this->returnValue($onlyEmail ? array('email') : array()));
37+
->will($this->returnValue($onlyEmail ? array('email') : array('username')));
3638

3739
$filter = new Filter($options);
3840

0 commit comments

Comments
 (0)