propel-bundle/Tests/Model/AclClassTest.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2013-12-14 12:44:04 +01:00
<?php
/**
* This file is part of the PropelBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
2016-02-11 19:14:03 +01:00
namespace Propel\Bundle\PropelBundle\Tests\Model\Acl;
2013-12-14 12:44:04 +01:00
2016-02-11 19:14:03 +01:00
use Propel\Bundle\PropelBundle\Model\Acl\AclClass;
use Propel\Bundle\PropelBundle\Model\Acl\AclClassQuery;
2013-12-14 12:44:04 +01:00
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
2016-02-11 19:14:03 +01:00
use Propel\Bundle\PropelBundle\Tests\AclTestCase;
2013-12-14 12:44:04 +01:00
/**
* @author Toni Uebernickel <tuebernickel@gmail.com>
*/
class AclClassTest extends AclTestCase
{
public function testFromAclObjectIdentity()
{
$type = 'Merchant';
$aclClass = AclClass::fromAclObjectIdentity(new ObjectIdentity(5, $type), $this->con);
2016-02-11 19:14:03 +01:00
$this->assertInstanceOf('Propel\Bundle\PropelBundle\Model\Acl\AclClass', $aclClass);
2013-12-14 12:44:04 +01:00
$this->assertEquals($type, $aclClass->getType());
$dbEntry = AclClassQuery::create()->findOne($this->con);
2016-02-11 19:14:03 +01:00
$this->assertInstanceOf('Propel\Bundle\PropelBundle\Model\Acl\AclClass', $dbEntry);
2013-12-14 12:44:04 +01:00
$this->assertEquals($type, $dbEntry->getType());
$this->assertEquals($dbEntry->getId(), $aclClass->getId());
}
}