summaryrefslogtreecommitdiffstats
path: root/Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php')
-rw-r--r--Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php b/Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php
new file mode 100644
index 0000000..59fc3bd
--- /dev/null
+++ b/Acl/Tests/Domain/ObjectIdentityRetrievalStrategyTest.php
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Acl\Tests\Domain;
+
+use Symfony\Component\Security\Acl\Domain\ObjectIdentityRetrievalStrategy;
+
+class ObjectIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase
+{
+ public function testGetObjectIdentityReturnsNullForInvalidDomainObject()
+ {
+ $strategy = new ObjectIdentityRetrievalStrategy();
+ $this->assertNull($strategy->getObjectIdentity('foo'));
+ }
+
+ public function testGetObjectIdentity()
+ {
+ $strategy = new ObjectIdentityRetrievalStrategy();
+ $domainObject = new DomainObject();
+ $objectIdentity = $strategy->getObjectIdentity($domainObject);
+
+ $this->assertEquals($domainObject->getId(), $objectIdentity->getIdentifier());
+ $this->assertEquals(get_class($domainObject), $objectIdentity->getType());
+ }
+}
+
+class DomainObject
+{
+ public function getId()
+ {
+ return 'foo';
+ }
+}