@@ 1267-1279 (lines=13) @@ | ||
1264 | * @param string $name |
|
1265 | * @return Permission |
|
1266 | */ |
|
1267 | protected function getPermission($id, $name) |
|
1268 | { |
|
1269 | $permission = new Permission(); |
|
1270 | ||
1271 | $reflection = new \ReflectionClass('Oro\Bundle\SecurityBundle\Entity\Permission'); |
|
1272 | $reflectionProperty = $reflection->getProperty('id'); |
|
1273 | $reflectionProperty->setAccessible(true); |
|
1274 | $reflectionProperty->setValue($permission, $id); |
|
1275 | ||
1276 | $permission->setName($name); |
|
1277 | ||
1278 | return $permission; |
|
1279 | } |
|
1280 | ||
1281 | /** |
|
1282 | * @return \PHPUnit_Framework_MockObject_MockObject|PermissionManager |
@@ 44-55 (lines=12) @@ | ||
41 | $this->assertEquals($label, (string)$role); |
|
42 | } |
|
43 | ||
44 | public function testClone() |
|
45 | { |
|
46 | $role = new Role(); |
|
47 | ||
48 | $class = new \ReflectionClass($role); |
|
49 | $prop = $class->getProperty('id'); |
|
50 | $prop->setAccessible(true); |
|
51 | $prop->setValue($role, 1); |
|
52 | ||
53 | $copy = clone $role; |
|
54 | $this->assertEmpty($copy->getId()); |
|
55 | } |
|
56 | } |
|
57 |
@@ 18-29 (lines=12) @@ | ||
15 | * http://api.symfony.com/2.3/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.html |
|
16 | * #method_disallowNewKeysInSubsequentConfigs |
|
17 | */ |
|
18 | public function setExtensionConfig($name, array $config = []) |
|
19 | { |
|
20 | $classRef = new \ReflectionClass('Symfony\Component\DependencyInjection\ContainerBuilder'); |
|
21 | $extensionConfigsRef = $classRef->getProperty('extensionConfigs'); |
|
22 | $extensionConfigsRef->setAccessible(true); |
|
23 | ||
24 | $newConfig = $extensionConfigsRef->getValue($this); |
|
25 | $newConfig[$name] = $config; |
|
26 | $extensionConfigsRef->setValue($this, $newConfig); |
|
27 | ||
28 | $extensionConfigsRef->setAccessible(false); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * Changes a priority of a compiler pass |