Skip to content

Commit b8abfbc

Browse files
Use fake mcrypt binary for unit testing
1 parent c9db48a commit b8abfbc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/phpbu/Backup/Crypter/McryptTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ public function tearDown()
3838
$this->mcrypt = null;
3939
}
4040

41+
/**
42+
* Tests Mcrypt::setUp
43+
*
44+
* @expectedException \RuntimeException
45+
*/
46+
public function testSetUpCantFindBinary()
47+
{
48+
$mcrypt = new Mcrypt();
49+
$mcrypt->setup(array('key' => 'fooBarBaz', 'algorithm' => 'blowfish', 'pathToMcrypt' => '/foo/bar/mcrypt'));
50+
}
51+
52+
/**
53+
* Tests Mcrypt::setUp
54+
*/
55+
public function testSetUpFindBinary()
56+
{
57+
$path = realpath(__DIR__ . '/../../../_files/bin');
58+
$mcrypt = new Mcrypt();
59+
$mcrypt->setup(array('key' => 'fooBarBaz', 'algorithm' => 'blowfish', 'pathToMcrypt' => $path));
60+
61+
$this->assertTrue(true, 'no exception should be thrown');
62+
}
63+
4164
/**
4265
* Tests Mcrypt::setUp
4366
*/

0 commit comments

Comments
 (0)