Completed
Push — master ( 379b70...ba77f4 )
by Aimeos
01:23
created

Typo3Test::testEncodeNull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Aimeos\MShop\Common\Helper\Password;
4
5
6
/**
7
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
8
 * @copyright Aimeos (aimeos.org), 2015-2018
9
 */
10
class Typo3Test extends \PHPUnit\Framework\TestCase
11
{
12
	public function testException()
13
	{
14
		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
15
		new \Aimeos\MShop\Common\Helper\Password\Typo3( [] );
16
	}
17
18
19
	public function testEncodeNull()
20
	{
21
		$object = new \Aimeos\MShop\Common\Helper\Password\Typo3( array( 'object' => null ) );
22
		$this->assertEquals( 'unittest', $object->encode( 'unittest', 'salt' ) );
23
	}
24
25
26
	public function testEncodeObject()
27
	{
28
		$object = new \Aimeos\MShop\Common\Helper\Password\Typo3( array( 'object' => new TestPasswordHasherTypo3() ) );
29
		$this->assertEquals( 'abcd', $object->encode( 'unittest', 'salt' ) );
30
	}
31
}
32
33
34
class TestPasswordHasherTypo3
35
{
36
	public function getHashedPassword( $password, $salt )
0 ignored issues
show
Unused Code introduced by
The parameter $password is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $salt is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
	{
38
		return 'abcd';
39
	}
40
}