Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added testcase for BlockCipher using 0 values #5902

Closed
wants to merge 1 commit into from

4 participants

@auterium

Tested against 0 (integer), 0.0 (float), and '0' (string). All 3 values should be accepted

@auterium auterium Added testcase
Tested against 0 (integer), 0.0 (float), and '0' (string). All 3 values should be accepted
2962d86
@auterium

@Maks3w here's the test case for #5680

@Maks3w Maks3w commented on the diff
tests/ZendTest/Crypt/BlockCipherTest.php
@@ -149,6 +149,23 @@ public function testEncryptDecryptUsingBinary()
}
}
+ public function testEncryptDecryptUsingZero()
+ {
+ $possibleValues = array(0, 0.0, '0');
@Maks3w Collaborator
Maks3w added a note

Please refactor this for use a data provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w Maks3w added this to the 2.2.6 milestone
@weierophinney weierophinney modified the milestone: 2.3.0, 2.2.6
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#5902] Implement fix for issue demonstrated in test
- Changed test to use a data provider
- Implemented a fix for the behavior demonstrated by the test
f0e9db0
@ezimuel ezimuel was unassigned by weierophinney
@weierophinney weierophinney self-assigned this
@weierophinney

Merged to master with updates to the library that address the issue demonstrated in the tests.

@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-crypt
@weierophinney weierophinney Merge pull request zendframework/zf2#5902 from auterium/patch-1
Added testcase for BlockCipher using 0 values
5842cb2
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-crypt
@weierophinney weierophinney [zendframework/zf2#5902] Implement fix for issue demonstrated in test
- Changed test to use a data provider
- Implemented a fix for the behavior demonstrated by the test
d0b71b7
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-crypt
@weierophinney weierophinney Merge branch 'hotfix/5902' into develop 8eb6c65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 3, 2014
  1. @auterium

    Added testcase

    auterium authored
    Tested against 0 (integer), 0.0 (float), and '0' (string). All 3 values should be accepted
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/ZendTest/Crypt/BlockCipherTest.php
View
17 tests/ZendTest/Crypt/BlockCipherTest.php
@@ -149,6 +149,23 @@ public function testEncryptDecryptUsingBinary()
}
}
+ public function testEncryptDecryptUsingZero()
+ {
+ $possibleValues = array(0, 0.0, '0');
@Maks3w Collaborator
Maks3w added a note

Please refactor this for use a data provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ $this->blockCipher->setKey('test');
+ $this->blockCipher->setKeyIteration(1000);
+ foreach ($this->blockCipher->getCipherSupportedAlgorithms() as $algo) {
+ $this->blockCipher->setCipherAlgorithm($algo);
+
+ foreach($passibleValues as $plaintext) {
+ $encrypted = $this->blockCipher->encrypt($plaintext);
+ $this->assertTrue(!empty($encrypted));
+ $decrypted = $this->blockCipher->decrypt($encrypted);
+ $this->assertEquals($decrypted, $plaintext);
+ }
+ }
+ }
+
public function testDecryptAuthFail()
{
$this->blockCipher->setKey('test');
Something went wrong with that request. Please try again.