Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84dd924

Browse files
committed
Simplifying - we just use whatever message you pass
1 parent 32d9a6a commit 84dd924

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

src/Symfony/Component/Security/Core/Exception/SafeMessageAuthenticationException.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ public function __construct($message = '', array $messageData = array(), $code =
3030
{
3131
parent::__construct($message, $code, $previous);
3232

33-
if ('' !== $message) {
34-
$this->messageKey = $message;
35-
}
36-
37-
$this->messageData = $messageData;
33+
$this->setSafeMessage($message, $messageData);
3834
}
3935

4036
/**
@@ -51,7 +47,7 @@ public function setSafeMessage($messageKey, array $messageData = array())
5147

5248
public function getMessageKey()
5349
{
54-
return null !== $this->messageKey ? $this->messageKey : parent::getMessageKey();
50+
return $this->messageKey;
5551
}
5652

5753
public function getMessageData()

src/Symfony/Component/Security/Core/Tests/Exception/SafeMessageAuthenticationExceptionTest.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Security\Core\Tests\Exception;
1313

14-
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1514
use Symfony\Component\Security\Core\Exception\SafeMessageAuthenticationException;
1615

1716
class SafeMessageAuthenticationExceptionTest extends \PHPUnit_Framework_TestCase
@@ -24,30 +23,4 @@ public function testConstructWithSAfeMessage()
2423
$this->assertEquals(array('foo' => true), $e->getMessageData());
2524
$this->assertEquals('SAFE MESSAGE', $e->getMessage());
2625
}
27-
28-
/**
29-
* @dataProvider provideKeysAndData
30-
*/
31-
public function testMessageKeyAndData($key, array $data, $expectedKey, array $expectedData)
32-
{
33-
$e = new SafeMessageAuthenticationException();
34-
$e->setSafeMessage($key, $data);
35-
36-
$this->assertEquals($expectedKey, $e->getMessageKey());
37-
$this->assertEquals($expectedData, $e->getMessageData());
38-
}
39-
40-
public function provideKeysAndData()
41-
{
42-
// the parent exception
43-
$authenticationException = new AuthenticationException();
44-
45-
$tests = array();
46-
// null key means the parent is used
47-
$tests[] = array(null, array(), $authenticationException->getMessageKey(), array());
48-
$tests[] = array('', array(), '', array());
49-
$tests[] = array('MESSAGE', array('bar' => false), 'MESSAGE', array('bar' => false));
50-
51-
return $tests;
52-
}
5326
}

0 commit comments

Comments
 (0)