public function testResolveCollision()
 {
     $namer = $this->getMockBuilder('Iphp\\FileStoreBundle\\Naming\\DefaultNamer')->disableOriginalConstructor()->getMock();
     $this->container->expects($this->once())->method('get')->with('test.service')->will($this->returnValue($namer));
     $namer->expects($this->once())->method('resolveCollision')->with('sample-file-name', 1)->will($this->returnValue('sample-file-name_1'));
     $this->assertSame($this->invoker->resolveCollision('test.service', 'sample-file-name', 1), 'sample-file-name_1');
 }
 protected function setUp()
 {
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->with('oro_security.security_facade')->willReturn($this->securityFacade);
     $this->provider = new AclGroupProvider($this->container);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $controller = $this->createMock(ControllerInterface::class);
     $scheduler = $this->createMock(SchedulerInterface::class);
     $registry = new IteratorRegistry();
     $this->container = $this->createMock(ContainerInterface::class);
     $this->container->expects($this->any())->method('get')->will($this->returnCallback(function ($key) use($scheduler, $registry, $controller) {
         if ($key == 'abc.scheduler.scheduler') {
             return $scheduler;
         } elseif ($key == 'abc.scheduler.iterator_registry') {
             return $registry;
         } elseif ($key == 'abc.process_control.controller') {
             return $controller;
         }
     }));
     $controller->expects($this->any())->method('doStop')->willReturn(false);
     $command = new SchedulerProcessCommand();
     $command->setContainer($this->container);
     $kernel = $this->createMock(KernelInterface::class);
     $this->application = new Application($kernel);
     $this->application->add($command);
     $this->scheduler = $scheduler;
     $this->registry = $registry;
     $this->controller = $controller;
 }
 protected function setUp()
 {
     if (!class_exists('Doctrine\\DBAL\\DriverManager')) {
         $this->markTestSkipped('The Doctrine2 DBAL is required for this test');
     }
     $this->ownerTree = new OwnerTree();
     $this->metadataProvider = new OwnershipMetadataProviderStub($this);
     $objectIdAccessor = new ObjectIdAccessor();
     /** @var \PHPUnit_Framework_MockObject_MockObject|OwnerTreeProvider $treeProviderMock */
     $treeProviderMock = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\OwnerTreeProvider')->disableOriginalConstructor()->getMock();
     $treeProviderMock->expects($this->any())->method('getTree')->will($this->returnValue($this->ownerTree));
     $configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configProvider->expects($this->any())->method('hasConfig')->willReturn(false);
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_security.ownership_tree_provider.chain', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $treeProviderMock], ['oro_security.owner.metadata_provider.chain', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->metadataProvider], ['oro_security.acl.object_id_accessor', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $objectIdAccessor], ['oro_security.owner.entity_owner_accessor', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, new EntityOwnerAccessor($this->metadataProvider)], ['oro_entity_config.provider.security', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $configProvider]]));
     $decisionMaker = new EntityOwnershipDecisionMaker($treeProviderMock, $objectIdAccessor, new EntityOwnerAccessor($this->metadataProvider), $this->metadataProvider);
     $decisionMaker->setContainer($this->container);
     $this->strategy = new PermissionGrantingStrategy($decisionMaker, $this->metadataProvider);
     $this->selector = TestHelper::get($this)->createAclExtensionSelector($this->metadataProvider, $this->ownerTree, $decisionMaker);
     $this->context = new PermissionGrantingStrategyContext($this->selector);
     $contextLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock();
     $contextLink->expects($this->any())->method('getService')->will($this->returnValue($this->context));
     $this->strategy->setContext($contextLink);
     $user = new User(1);
     $user->setUsername('TestUser');
     $this->sid = new UserSecurityIdentity('TestUser', get_class($user));
     $this->rsid = new RoleSecurityIdentity('TestRole');
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $token->expects($this->any())->method('getUser')->will($this->returnValue($user));
     $this->context->setSecurityToken($token);
     $this->context->setObject(new TestEntity('testId'));
     $this->map = new PermissionMap($this->selector);
 }
 public function testGenerateGridFilterUrl()
 {
     $returnedFilter = new Filter('testFilter', 'testServiceId');
     $this->filterRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_FILTER_ID))->will($this->returnValue($returnedFilter));
     $this->container->expects($this->once())->method('get')->with($this->equalTo($returnedFilter->getServiceId()))->will($this->returnValue($this->filterUrlGenerator));
     $this->filterUrlGenerator->expects($this->once())->method('generateFilterUrlPart');
     $this->ticketGridFiltersService->generateGridFilterUrl(self::DUMMY_FILTER_ID);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->assetsHelperMock = $this->getMockBuilder('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper')->disableOriginalConstructor()->getMock();
     $this->routerMock = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $this->containerMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->containerMock->expects($this->any())->method('get')->will($this->returnValueMap(array(array('templating.helper.assets', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->assetsHelperMock), array('router', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->routerMock))));
     $this->helper = new CKEditorHelper($this->containerMock);
 }
 /**
  * Setup the HandlerTest.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->containerMock = $this->getMock("Symfony\\Component\\DependencyInjection\\ContainerInterface");
     $this->persistenceFactory = new Factory($this->containerMock, 'persistence_mock');
     $this->persistenceMock = $this->getMock("eZ\\Publish\\SPI\\Persistence\\Handler");
     $this->containerMock->expects($this->once())->method('get')->with('persistence_mock')->will($this->returnValue($this->persistenceMock));
 }
 protected function setUp()
 {
     MockAnnotations::init($this);
     $this->auditEntityMapper->addAuditEntryClass('Diamante\\UserBundle\\Entity\\DiamanteUser', 'Diamante\\DeskBundle\\Entity\\Audit');
     $this->auditEntityMapper->addAuditEntryFieldClass('Diamante\\UserBundle\\Entity\\DiamanteUser', 'Diamante\\DeskBundle\\Entity\\AuditField');
     $this->container->expects($this->any())->method('get')->will($this->returnValue($this->oroAuditEntityMapper))->with($this->equalTo('oro_dataaudit.loggable.audit_entity_mapper'));
     $this->loggableManager = new LoggableManager('Oro\\Bundle\\DataAuditBundle\\Entity\\Audit', 'Oro\\Bundle\\DataAuditBundle\\Entity\\AuditField', $this->provider, $this->securityContextLink, $this->auditEntityMapper, $this->container);
 }
 /**
  * @param mixed $user
  * @param string $class
  * @param bool $expected
  *
  * @dataProvider applicableDataProvider
  */
 public function testIsApplicable($user, $class, $expected)
 {
     $this->container->expects($this->once())->method('getParameter')->with('orob2b_customer.entity.account_user.class')->willReturn($class);
     $securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $securityFacade->expects($this->once())->method('getLoggedUser')->willReturn($user);
     $this->container->expects($this->once())->method('get')->with('oro_security.security_facade')->willReturn($securityFacade);
     $this->assertEquals($expected, $this->extension->isApplicable(DatagridConfiguration::create([])));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->resourceRegistry = $this->createServiceRegistryMock();
     $this->localeContext = $this->createLocaleContextMock();
     $this->container = $this->createContainerMock();
     $this->container->expects($this->atLeast(1))->method('get')->will($this->returnValueMap([['lug.resource.registry', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->resourceRegistry], ['lug.translation.context.locale', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->localeContext]]));
     $this->repositoryFactory = new TranslatableRepositoryFactory($this->container);
 }
 /**
  * Test isActivePath method
  */
 public function testIsActivePath()
 {
     $this->request->expects($this->any())->method('getRequestUri')->will($this->returnValue('some/request/uri'));
     $this->container->expects($this->any())->method('get')->with($this->equalTo('request'))->will($this->returnValue($this->request));
     $this->extension->setActivePaths(array('some/specific/path'));
     $this->assertEquals(array('some/specific/path'), $this->extension->getActivePaths(), 'setActivePaths: Should return an array with "some/specific/path"');
     $this->assertTrue($this->extension->isActivePath('some/specific/path'), 'isActivePath: Should return true');
     $this->assertTrue($this->extension->isActivePath('some/request/uri'), 'isActivePath: Should return false');
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->container = $this->createContainerMock();
     $this->resourceRegistry = $this->createRegistryMock();
     $this->localeContext = $this->createLocaleContextMock();
     $this->factoryRegistry = $this->createRegistryMock();
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['lug.resource.registry', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->resourceRegistry], ['lug.translation.context.locale', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->localeContext], ['lug.resource.registry.factory', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->factoryRegistry]]));
     $this->translatableResourceSubscriber = new TranslatableResourceSubscriber($this->container);
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->container = $this->createContainerMock();
     $this->localeProvider = $this->createLocaleProviderMock();
     $this->localeIntegrityValidator = new LocaleIntegrityValidator($this->localeProvider);
     $this->constraintValidatorFactory = new ConstraintValidatorFactory($this->container, ['lug_locale_integrity' => $localeIntegrityService = 'lug.locale.validator.integrity']);
     $this->container->expects($this->any())->method('get')->with($this->identicalTo($localeIntegrityService))->will($this->returnValue($this->localeIntegrityValidator));
     $this->validator = Validation::createValidatorBuilder()->setConstraintValidatorFactory($this->constraintValidatorFactory)->addXmlMapping(__DIR__ . '/Fixtures/locale_integrity.xml')->getValidator();
 }
 public function testIterator()
 {
     $this->container->expects($this->at(0))->method('get')->with('bar_service')->will($this->returnValue($a = new \stdClass()));
     $this->container->expects($this->at(1))->method('get')->with('baz_service')->will($this->returnValue($b = new \stdClass()));
     $iterator = $this->map->getIterator();
     $this->assertSame($a, $iterator->current());
     $iterator->next();
     $this->assertSame($b, $iterator->current());
 }
 protected function setUp()
 {
     $this->treeProvider = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\OwnerTreeProvider')->disableOriginalConstructor()->getMock();
     $this->metadataProvider = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\Metadata\\OwnershipMetadataProvider')->disableOriginalConstructor()->getMock();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_security.ownership_tree_provider', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->treeProvider], ['oro_security.owner.metadata_provider.chain', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->metadataProvider], ['oro_security.security_facade', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityFacade]]));
     $this->decisionMaker = new EntityOwnershipDecisionMaker();
     $this->decisionMaker->setContainer($this->container);
 }
 public function setUp()
 {
     $this->pluginTypeDefinition = ['id' => $this->randomMachineName(), 'label' => $this->getRandomGenerator()->string(), 'description' => $this->getRandomGenerator()->string(), 'provider' => $this->randomMachineName(), 'plugin_manager_service_id' => $this->randomMachineName(), 'field_type' => (bool) mt_rand(0, 1)];
     $class_resolver = $this->getMock(ClassResolverInterface::class);
     $this->pluginManager = $this->getMock(PluginManagerInterface::class);
     $this->container = $this->getMock(ContainerInterface::class);
     $map = [['class_resolver', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $class_resolver], ['string_translation', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->getStringTranslationStub()], [$this->pluginTypeDefinition['plugin_manager_service_id'], ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->pluginManager]];
     $this->container->expects($this->atLeastOnce())->method('get')->willReturnMap($map);
     $this->sut = PluginType::createFromDefinition($this->container, $this->pluginTypeDefinition);
 }
Example #17
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->assetsHelperMock = $this->getMockBuilder('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper')->disableOriginalConstructor()->getMock();
     $this->assetsHelperMock->expects($this->any())->method('getUrl')->will($this->returnArgument(0));
     $this->assetsVersionTrimerHelperMock = $this->getMock('Ivory\\CKEditorBundle\\Helper\\AssetsVersionTrimerHelper');
     $this->assetsVersionTrimerHelperMock->expects($this->any())->method('trim')->will($this->returnArgument(0));
     $this->routerMock = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $this->containerMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->containerMock->expects($this->any())->method('get')->will($this->returnValueMap(array(array('templating.helper.assets', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->assetsHelperMock), array('ivory_ck_editor.helper.assets_version_trimer', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->assetsVersionTrimerHelperMock), array('router', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->routerMock))));
 }
 public function testLazyLoadedService()
 {
     /** @noinspection PhpUndefinedMethodInspection */
     $this->container->expects($this->once())->method('get')->with($this->equalTo('fixture.wrapper.for.service'))->will($this->returnValue(new WrapperForService()));
     $collection = $this->loader->load('fixture.wrapper.for.service', 'diamante_rest_service');
     $this->assertEquals(6, $collection->count());
     $this->assertEquals('GET', $collection->get('fixture_wrapper_for_service_get_entity')->getRequirement('_method'));
     $this->assertEquals('PUT', $collection->get('fixture_wrapper_for_service_put_entity')->getRequirement('_method'));
     $this->assertEquals('PUT|PATCH', $collection->get('fixture_wrapper_for_service_put_and_patch_entity')->getRequirement('_method'));
     $this->assertEquals('DELETE', $collection->get('fixture_wrapper_for_service_delete_entity')->getRequirement('_method'));
 }
 protected function setUp()
 {
     $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $this->entityClassResolver = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\EntityClassResolver')->disableOriginalConstructor()->getMock();
     $this->cache = $this->getMockBuilder('Doctrine\\Common\\Cache\\CacheProvider')->setMethods(['fetch', 'save'])->getMockForAbstractClass();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_entity_config.provider.ownership', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->configProvider], ['oro_security.owner.ownership_metadata_provider.cache', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->cache], ['oro_entity.orm.entity_class_resolver', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->entityClassResolver], ['oro_security.security_facade', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityFacade]]));
     $this->provider = new OwnershipMetadataProvider(['organization' => 'AcmeBundle:Organization', 'business_unit' => 'AcmeBundle:BusinessUnit', 'user' => 'AcmeBundle:User']);
     $this->provider->setContainer($this->container);
 }
Example #20
0
 protected function getStatementMock()
 {
     $statement = $this->getMock('\\Oro\\Bundle\\TestFrameworkBundle\\Test\\Doctrine\\ORM\\Mocks\\StatementMock');
     $statement->expects($this->exactly(2))->method('bindValue');
     $statement->expects($this->once())->method('execute');
     $conn = $this->getMockBuilder('\\Doctrine\\DBAL\\Connection')->disableOriginalConstructor()->setMethods(['prepare'])->getMock();
     $conn->expects($this->once())->method('prepare')->will($this->returnValue($statement));
     $this->emMock->expects($this->once())->method('getConnection')->will($this->returnValue($conn));
     $this->container->expects($this->once())->method('get')->with('doctrine.orm.entity_manager')->will($this->returnValue($this->emMock));
     return $statement;
 }
 /**
  * @covers \Onurb\Bundle\YumlBundle\Controller\YumlController
  */
 public function testIndexAction()
 {
     $yumlClient = $this->getMock('Onurb\\Bundle\\YumlBundle\\Yuml\\YumlClientInterface');
     $yumlClient->expects($this->once())->method('makeDslText')->will($this->returnValue('[Simple.Entity|+a;b;c]'));
     $yumlClient->expects($this->once())->method('getGraphUrl')->will($this->returnValue('http://yuml.me/15a98c92.png'));
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->once())->method('get')->with($this->matches('onurb.doctrine_yuml.client'))->will($this->returnValue($yumlClient));
     $controller = $this->createController();
     $response = $controller->indexAction();
     //On teste si la réponse est bien une redirection.
     $this->assertTrue($response instanceof RedirectResponse);
 }
 public function setUp()
 {
     $this->role = 'IS_FOOBAR';
     $this->container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->setMockClassName('Container')->getMock();
     $this->sc = $this->getMock('Symfony\\Component\\Security\\Core\\SecurityContextInterface');
     $this->container->expects($this->any())->method('get')->with('security.context')->will($this->returnValue($this->sc));
     $this->container->expects($this->any())->method('has')->with('security.context')->will($this->returnValue(true));
     $this->doc = $this->getMock('Symfony\\Cmf\\Bundle\\CoreBundle\\PublishWorkflow\\PublishableReadInterface');
     $this->adm = $this->getMock('Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface');
     $this->stdClass = new \stdClass();
     $this->pwfc = new PublishWorkflowChecker($this->container, $this->adm, $this->role);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->manager = $this->createMock(ManagerInterface::class);
     $this->serializer = $this->createMock(SerializerInterface::class);
     $this->validator = $this->createMock(ValidatorInterface::class);
     $this->jobManager = $this->createMock(JobManagerInterface::class);
     $this->container = $this->createMock(ContainerInterface::class);
     $services = ['abc.job.manager' => $this->manager, 'abc.job.job_manager' => $this->jobManager, 'abc.job.validator' => $this->validator, 'abc.job.serializer' => $this->serializer];
     $this->container->expects($this->any())->method('get')->willReturnCallback(function ($key) use($services) {
         return $services[$key];
     });
 }
 public function testASetOfEventHandlersCanBeRetrieved()
 {
     $service1 = 'serviceInstance1';
     $service2 = 'serviceInstance2';
     $this->locator->registerEventHandlerService('service1', ['EventA', 'EventB']);
     $this->locator->registerEventHandlerService('service2', ['EventB', 'EventC']);
     $this->containerMock->expects(self::any())->method('get')->willReturnMap([['service1', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service1], ['service2', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service2]]);
     self::assertEquals([$service1], $this->locator->getHandlersForEvent('EventA'));
     self::assertEquals([$service1, $service2], $this->locator->getHandlersForEvent('EventB'));
     self::assertEquals([$service2], $this->locator->getHandlersForEvent('EventC'));
     self::assertEquals([], $this->locator->getHandlersForEvent('EventNone'));
 }
 public function setUp()
 {
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     // Mock ContainerInterface::get() to return the service ID
     $this->container->expects($this->any())->method('get')->will($this->returnArgument(0));
     $this->registry = new ProviderRegistry();
     $this->registry->setContainer($this->container);
     $this->registry->addProvider('foo', 'a', 'provider.foo.a');
     $this->registry->addProvider('foo', 'b', 'provider.foo.b');
     $this->registry->addProvider('foo', 'c', 'provider.foo.c');
     $this->registry->addProvider('bar', 'a', 'provider.bar.a');
     $this->registry->addProvider('bar', 'b', 'provider.bar.b');
 }
 public function setUp()
 {
     $this->c = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(['getParameter'])->getMock();
     $this->c->expects($this->any())->method('getParameter')->will($this->returnValue('./tests/fixtures/'));
     $this->f = $this->getMockBuilder('Scribe\\Arthur\\DoctrineFixturesBundle\\DataFixtures\\YamlFixture')->setMethods(['getFixtureFileSearchPaths'])->getMock();
     $this->f->expects($this->any())->method('getFixtureFileSearchPaths')->will($this->returnValue(FixturePaths::create()->cartesianProductFromPaths(['tests/fixtures'])));
     $reflectionF = new \ReflectionClass('Scribe\\Arthur\\DoctrineFixturesBundle\\DataFixtures\\YamlFixture');
     $reflectionContainer = $reflectionF->getProperty('container');
     $reflectionContainer->setAccessible(true);
     $reflectionContainer->setValue($this->f, $this->c);
     $this->paths = $searchPaths = FixturePaths::create()->cartesianProductFromPaths([$this->c->getParameter('kernel.root_dir')]);
     parent::setUp();
 }
 protected function setUp()
 {
     $this->cache = $this->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
     $this->cache->expects($this->any())->method('fetch')->will($this->returnValue(false));
     $this->cache->expects($this->any())->method('save');
     $this->ownershipMetadataProvider = $this->getMockBuilder('OroB2B\\Bundle\\CustomerBundle\\Owner\\Metadata\\FrontendOwnershipMetadataProvider')->disableOriginalConstructor()->getMock();
     $this->managerRegistry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->willReturnMap([['orob2b_customer.owner.frontend_ownership_tree_provider.cache', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->cache], ['orob2b_customer.owner.frontend_ownership_metadata_provider', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->ownershipMetadataProvider], ['doctrine', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->managerRegistry], ['oro_security.security_facade', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityFacade]]);
     $this->treeProvider = new FrontendOwnerTreeProvider();
     $this->treeProvider->setContainer($this->container);
 }
 protected function setUp()
 {
     $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->securityConfigProvider = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProviderInterface');
     $this->entityClassResolver = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\EntityClassResolver')->disableOriginalConstructor()->getMock();
     $this->entityClassResolver->expects($this->any())->method('getEntityClass')->willReturnMap([['OroB2BAccountBundle:Account', self::LOCAL_LEVEL], ['OroB2BAccountBundle:AccountUser', self::BASIC_LEVEL], [self::LOCAL_LEVEL, self::LOCAL_LEVEL], [self::BASIC_LEVEL, self::BASIC_LEVEL]]);
     $this->cache = $this->getMockBuilder('Doctrine\\Common\\Cache\\CacheProvider')->setMethods(['fetch', 'save'])->getMockForAbstractClass();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_entity_config.provider.ownership', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->configProvider], ['orob2b_account.owner.frontend_ownership_metadata_provider.cache', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->cache], ['oro_entity.orm.entity_class_resolver', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->entityClassResolver], ['oro_security.security_facade', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityFacade], ['oro_entity_config.provider.security', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityConfigProvider]]));
     $this->provider = new FrontendOwnershipMetadataProvider(['local_level' => self::LOCAL_LEVEL, 'basic_level' => self::BASIC_LEVEL]);
     $this->provider->setContainer($this->container);
 }
 protected function setUp()
 {
     $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $managerRegistry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $managerRegistry->expects($this->any())->method('getManagerForClass')->willReturn($this->em);
     $this->cache = $this->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
     $this->cache->expects($this->any())->method('fetch')->will($this->returnValue(false));
     $this->cache->expects($this->any())->method('save');
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_security.ownership_tree_provider.cache', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->cache], ['oro_security.owner.ownership_metadata_provider', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, new OwnershipMetadataProviderStub($this, ['user' => 'Oro\\Bundle\\UserBundle\\Entity\\User', 'business_unit' => 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit'])], ['doctrine', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $managerRegistry], ['oro_security.security_facade', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->securityFacade]]));
     $this->treeProvider = new OwnerTreeProvider($this->em, $this->cache);
     $this->treeProvider->setContainer($this->container);
 }
 protected function setUp()
 {
     $this->tree = new OwnerTree();
     $this->metadataProvider = new OwnershipMetadataProviderStub($this);
     $this->metadataProvider->setMetadata($this->metadataProvider->getOrganizationClass(), new OwnershipMetadata());
     $this->metadataProvider->setMetadata($this->metadataProvider->getBusinessUnitClass(), new OwnershipMetadata('BUSINESS_UNIT', 'owner', 'owner_id', 'organization'));
     $this->metadataProvider->setMetadata($this->metadataProvider->getUserClass(), new OwnershipMetadata('BUSINESS_UNIT', 'owner', 'owner_id', 'organization'));
     /** @var OwnerTreeProvider|\PHPUnit_Framework_MockObject_MockObject $treeProvider */
     $treeProvider = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\OwnerTreeProvider')->disableOriginalConstructor()->getMock();
     $treeProvider->expects($this->any())->method('getTree')->will($this->returnValue($this->tree));
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->container->expects($this->any())->method('get')->will($this->returnValueMap([['oro_security.ownership_tree_provider.chain', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $treeProvider], ['oro_security.owner.metadata_provider.chain', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->metadataProvider], ['oro_security.acl.object_id_accessor', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, new ObjectIdAccessor()], ['oro_security.owner.entity_owner_accessor', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, new EntityOwnerAccessor($this->metadataProvider)]]));
     $this->decisionMaker = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\AbstractEntityOwnershipDecisionMaker')->setMethods(['getContainer'])->getMockForAbstractClass();
     $this->decisionMaker->expects($this->any())->method('getContainer')->willReturn($this->container);
 }