Преглед на файлове

[Security] added a unit test for previous merge

Fabien Potencier преди 13 години
родител
ревизия
277d75b7ce
променени са 1 файла, в които са добавени 20 реда и са изтрити 0 реда
  1. 20 0
      tests/Symfony/Tests/Component/Security/Core/User/ChainUserProviderTest.php

+ 20 - 0
tests/Symfony/Tests/Component/Security/Core/User/ChainUserProviderTest.php

@@ -86,6 +86,26 @@ class ChainUserProviderTest extends \PHPUnit_Framework_TestCase
         $this->assertSame($account, $provider->refreshUser($this->getAccount()));
     }
 
+    public function testRefreshUserAgain()
+    {
+        $provider1 = $this->getProvider();
+        $provider1
+            ->expects($this->once())
+            ->method('refreshUser')
+            ->will($this->throwException(new UsernameNotFoundException('not found')))
+        ;
+
+        $provider2 = $this->getProvider();
+        $provider2
+            ->expects($this->once())
+            ->method('refreshUser')
+            ->will($this->returnValue($account = $this->getAccount()))
+        ;
+
+        $provider = new ChainUserProvider(array($provider1, $provider2));
+        $this->assertSame($account, $provider->refreshUser($this->getAccount()));
+    }
+
     /**
      * @expectedException Symfony\Component\Security\Core\Exception\UnsupportedUserException
      */