This repository has been archived by the owner on May 8, 2024. It is now read-only.
forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gwis-use-zend-crypt-hmac-in-crammd5'
- Loading branch information
Showing
3 changed files
with
52 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Mail | ||
*/ | ||
|
||
namespace ZendTest\Mail\Protocol\Smtp\Auth; | ||
|
||
use ReflectionClass; | ||
use Zend\Mail\Protocol\Smtp\Auth\Crammd5; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Mail | ||
* @subpackage UnitTests | ||
* @group Zend_Mail | ||
*/ | ||
class Crammd5Test extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Crammd5 | ||
*/ | ||
protected $auth; | ||
|
||
public function setUp() | ||
{ | ||
$this->auth = new Crammd5(); | ||
} | ||
|
||
public function testHmacMd5ReturnsExpectedHash() | ||
{ | ||
$class = new ReflectionClass('Zend\Mail\Protocol\Smtp\Auth\Crammd5'); | ||
$method = $class->getMethod('_hmacMd5'); | ||
$method->setAccessible(true); | ||
|
||
$result = $method->invokeArgs( | ||
$this->auth, | ||
array('frodo', 'speakfriendandenter') | ||
); | ||
|
||
$this->assertEquals('be56fa81a5671e0c62e00134180aae2c', $result); | ||
} | ||
} |