summaryrefslogtreecommitdiffstats
path: root/Acl/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Acl/Tests')
-rw-r--r--Acl/Tests/Domain/EntryTest.php2
-rw-r--r--Acl/Tests/Domain/ObjectIdentityTest.php24
2 files changed, 24 insertions, 2 deletions
diff --git a/Acl/Tests/Domain/EntryTest.php b/Acl/Tests/Domain/EntryTest.php
index 6a2aac0..ab8e481 100644
--- a/Acl/Tests/Domain/EntryTest.php
+++ b/Acl/Tests/Domain/EntryTest.php
@@ -36,7 +36,7 @@ class EntryTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($ace->isAuditSuccess());
$ace->setAuditSuccess(false);
$this->assertFalse($ace->isAuditSuccess());
- $ace->setAuditsuccess(true);
+ $ace->setAuditSuccess(true);
$this->assertTrue($ace->isAuditSuccess());
}
diff --git a/Acl/Tests/Domain/ObjectIdentityTest.php b/Acl/Tests/Domain/ObjectIdentityTest.php
index 4eab7b2..325bb91 100644
--- a/Acl/Tests/Domain/ObjectIdentityTest.php
+++ b/Acl/Tests/Domain/ObjectIdentityTest.php
@@ -64,6 +64,26 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
$this->assertEquals('Symfony\Component\Security\Acl\Tests\Domain\TestDomainObject', $id->getType());
}
+ public function testFromDomainObjectWithoutInterfaceEnforcesStringIdentifier()
+ {
+ $domainObject = new TestDomainObject();
+ $domainObject->id = 1;
+ $id = ObjectIdentity::fromDomainObject($domainObject);
+
+ $this->assertSame('1', $id->getIdentifier());
+ $this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
+ }
+
+ public function testFromDomainObjectWithoutInterfaceAllowsZeroAsIdentifier()
+ {
+ $domainObject = new TestDomainObject();
+ $domainObject->id = '0';
+ $id = ObjectIdentity::fromDomainObject($domainObject);
+
+ $this->assertSame('0', $id->getIdentifier());
+ $this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
+ }
+
/**
* @dataProvider getCompareData
*/
@@ -89,6 +109,8 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
class TestDomainObject
{
+ public $id = 'getId()';
+
public function getObjectIdentifier()
{
return 'getObjectIdentifier()';
@@ -96,7 +118,7 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
public function getId()
{
- return 'getId()';
+ return $this->id;
}
}
}