当前位置: 首页>>代码示例>>PHP>>正文


PHP ConfigManager::expects方法代码示例

本文整理汇总了PHP中Oro\Bundle\ConfigBundle\Config\ConfigManager::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::expects方法的具体用法?PHP ConfigManager::expects怎么用?PHP ConfigManager::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\ConfigBundle\Config\ConfigManager的用法示例。


在下文中一共展示了ConfigManager::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testChecksVisibilityFromConfig

 /**
  * @dataProvider visibilityDataProvider
  * @param string $visibility
  * @param bool $expected
  */
 public function testChecksVisibilityFromConfig($visibility, $expected)
 {
     $this->configManager->expects($this->once())->method('get')->with('orob2b_product.default_visibility')->willReturn($visibility);
     $product = $this->getProductMock();
     $product->expects($this->once())->method('getVisibility')->willReturn(Product::VISIBILITY_BY_CONFIG);
     $this->assertEquals($expected, $this->service->isVisible($product));
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:12,代码来源:VisibilityCheckerTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->record = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datasource\\ResultRecordInterface');
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->configManager->expects($this->any())->method('get')->with('oro_b2b_rfp.default_request_status')->will($this->returnValue(self::CONFIG_DEFAULT_STATUS));
     $this->actionPermissionProvider = new ActionPermissionProvider($this->configManager);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:10,代码来源:ActionPermissionProviderTest.php

示例3: testProcessEvent

 public function testProcessEvent()
 {
     $user = new User();
     $user->setId(1);
     $this->configManager->expects($this->once())->method('get')->with('diamante_desk.email_notification')->will($this->returnValue(true));
     $this->securityFacade->expects($this->once())->method('getLoggedUser')->will($this->returnValue($user));
     $event = $this->event();
     $this->notificationDeliveryManager->expects($this->once())->method('add')->with($this->logicalAnd($this->isInstanceOf('\\Diamante\\DeskBundle\\Model\\Ticket\\Notifications\\TicketNotification'), $this->attributeEqualTo('ticketUniqueId', $event->getAggregateId()), $this->attributeEqualTo('author', $user), $this->attributeEqualTo('headerText', $event->getHeaderText()), $this->attributeEqualTo('subject', $event->getSubject()), $this->attributeEqualTo('attachments', $event->attachments()), $this->attribute($this->logicalAnd($this->isInstanceOf('\\ArrayIterator'), $this->arrayHasKey('Description'), $this->contains('New Description')), 'changeList')));
     $this->subscriber->processEvent($event);
 }
开发者ID:northdakota,项目名称:DiamanteDeskBundle,代码行数:10,代码来源:TicketNotificationsSubscriberTest.php

示例4: testIsFresh

 /**
  * @dataProvider isFreshDataProvider
  *
  * @param array  $configData
  * @param array  $statisticData
  * @param string $langCode
  * @param bool   $expectedResult
  */
 public function testIsFresh(array $configData, array $statisticData, $langCode, $expectedResult)
 {
     $this->cm->expects($this->once())->method('get')->with($this->equalTo(TranslationStatusInterface::META_CONFIG_KEY))->will($this->returnValue($configData));
     $this->sp->expects($this->once())->method('get')->will($this->returnValue($statisticData));
     $result1 = $this->extension->isFresh($langCode);
     // second call should not fail expectation above
     // result should be cached
     $result2 = $this->extension->isFresh($langCode);
     $this->assertSame($result1, $result2);
     $this->assertSame($expectedResult, $result1);
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:TranslationStatusExtensionTest.php

示例5: testSubmit

 /**
  * @dataProvider submitProvider
  *
  * @param AccountUser $defaultData
  * @param array $submittedData
  * @param AccountUser $expectedData
  * @param User $owner
  */
 public function testSubmit($defaultData, array $submittedData, $expectedData, User $owner)
 {
     $this->configManager->expects($this->once())->method('get')->with('oro_b2b_account.default_account_owner')->willReturn(42);
     $repository = $this->assertUserRepositoryCall();
     $repository->expects($this->once())->method('find')->with(42)->willReturn($owner);
     $form = $this->factory->create($this->formType, $defaultData, []);
     $this->assertEquals($defaultData, $form->getData());
     $form->submit($submittedData);
     $this->assertTrue($form->isValid());
     $this->assertEquals($expectedData, $form->getData());
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:19,代码来源:FrontendAccountUserRegistrationTypeTest.php

示例6: testAddAttachment

 /**
  * @param bool $expected
  * @param [] $data
  * @param bool $configSyncEnabled
  * @param int $configSyncMaxSize
  *
  * @dataProvider addAttachmentProvider
  */
 public function testAddAttachment($expected, $data, $configSyncEnabled, $configSyncMaxSize)
 {
     $this->emailBodyBuilder->setEmailBody('test', true);
     $this->configManager->expects($this->at(0))->method('get')->with(EmailBodyBuilder::ORO_EMAIL_ATTACHMENT_SYNC_ENABLE)->willReturn($configSyncEnabled);
     if ($configSyncEnabled) {
         $this->configManager->expects($this->at(1))->method('get')->with(EmailBodyBuilder::ORO_EMAIL_ATTACHMENT_SYNC_MAX_SIZE)->willReturn($configSyncMaxSize);
     }
     $this->emailBodyBuilder->addEmailAttachment('test', 'content', 'ct', $data['contentTransferEncoding'], $data['embeddedContentId'], $data['contentSize']);
     $body = $this->emailBodyBuilder->getEmailBody();
     $this->assertEquals($expected, $body->getHasAttachments());
 }
开发者ID:startupz,项目名称:platform-1,代码行数:19,代码来源:EmailBodyBuilderTest.php

示例7: setUp

 protected function setUp()
 {
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->entityPool = $this->getMockBuilder('Oro\\Bundle\\NotificationBundle\\Doctrine\\EntityPool')->disableOriginalConstructor()->getMock();
     $this->emailRenderer = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\EmailRenderer')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('Swift_Mailer')->disableOriginalConstructor()->getMock();
     $this->cm = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->cm->expects($this->any())->method('get')->will($this->returnValueMap([['oro_notification.email_notification_sender_email', false, false, self::TEST_SENDER_EMAIL], ['oro_notification.email_notification_sender_name', false, false, self::TEST_SENDER_NAME]]));
     $this->processor = new EmailNotificationProcessor($this->logger, $this->entityManager, $this->entityPool, $this->emailRenderer, $this->mailer, $this->cm);
     $this->processor->setEnv(self::TEST_ENV);
     $this->processor->setMessageLimit(self::TEST_MESSAGE_LIMIT);
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:EmailNotificationProcessorTest.php

示例8: testGetVariableValues

 public function testGetVariableValues()
 {
     $organization = new Organization();
     $organization->setName('TestOrg');
     $user = new User();
     $user->setUsername('test');
     $user->setFirstName('FirstName');
     $user->setLastName('LastName');
     $this->securityFacade->expects($this->once())->method('getOrganization')->will($this->returnValue($organization));
     $this->securityFacade->expects($this->once())->method('getLoggedUser')->will($this->returnValue($user));
     $this->entityNameResolver->expects($this->once())->method('getName')->with($this->identicalTo($user))->will($this->returnValue('FullName'));
     $this->configManager->expects($this->once())->method('get')->with('oro_email.signature')->will($this->returnValue('Signature'));
     $result = $this->provider->getVariableValues();
     $this->assertEquals(['userName' => 'test', 'userFirstName' => 'FirstName', 'userLastName' => 'LastName', 'userFullName' => 'FullName', 'organizationName' => 'TestOrg', 'userSignature' => 'Signature'], $result);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:LoggedUserVariablesProviderTest.php

示例9: setUp

 protected function setUp()
 {
     $this->objectRepository = $this->getMockForClass('Oro\\Bundle\\EmailBundle\\Entity\\Repository\\EmailTemplateRepository');
     $this->objectManager = $this->getMockForClass('Doctrine\\Common\\Persistence\\ObjectManager');
     $this->objectManager->expects($this->any())->method('getRepository')->with('OroEmailBundle:EmailTemplate')->willReturn($this->objectRepository);
     $this->managerRegistry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $this->managerRegistry->expects($this->any())->method('getManagerForClass')->with('OroEmailBundle:EmailTemplate')->willReturn($this->objectManager);
     $this->configManager = $this->getMockForClass('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager');
     $this->configManager->expects($this->any())->method('get')->willReturnMap([['oro_notification.email_notification_sender_email', false, false, self::FROM_EMAIL], ['oro_notification.email_notification_sender_name', false, false, self::FROM_NAME]]);
     $this->renderer = $this->getMockForClass('Oro\\Bundle\\EmailBundle\\Provider\\EmailRenderer');
     $this->emailHolderHelper = $this->getMockForClass('Oro\\Bundle\\EmailBundle\\Tools\\EmailHolderHelper');
     $this->mailer = $this->getMockForClass('\\Swift_Mailer');
     $this->mailProcessor = new BaseProcessor($this->managerRegistry, $this->configManager, $this->renderer, $this->emailHolderHelper, $this->mailer);
     $this->emailTemplate = $this->getMock('Oro\\Bundle\\EmailBundle\\Model\\EmailTemplateInterface');
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:AbstractProcessorTest.php

示例10: testNotifyWithEmptyAuthor

 public function testNotifyWithEmptyAuthor()
 {
     $ticketUniqueId = UniqueId::generate();
     $reporter = new UserAdapter(1, UserAdapter::TYPE_DIAMANTE);
     $assignee = new User();
     $assignee->setId(2);
     $assignee->setEmail('assignee@host.com');
     $author = null;
     $branch = new Branch('KEY', 'Name', 'Description');
     $ticket = new Ticket($ticketUniqueId, new TicketSequenceNumber(1), 'Subject', 'Description', $branch, $reporter, $assignee, new Source(Source::WEB), new Priority(Priority::PRIORITY_MEDIUM), new Status(Status::NEW_ONE));
     $notification = new TicketNotification((string) $ticketUniqueId, $author, 'Header', 'Subject', new \ArrayIterator(array('key' => 'value')), array('file.ext'));
     $message = new \Swift_Message();
     $this->watchersService->expects($this->once())->method('getWatchers')->will($this->returnValue([new WatcherList($ticket, 'diamante_1')]));
     $this->diamanteUserRepository->expects($this->exactly(2))->method('get')->with(1)->will($this->returnValue($this->diamanteUser));
     $this->configManager->expects($this->once())->method('get')->will($this->returnValue('test@gmail.com'));
     $this->nameFormatter->expects($this->once())->method('format')->with($this->diamanteUser)->will($this->returnValue('First Last'));
     $this->mailer->expects($this->once())->method('createMessage')->will($this->returnValue($message));
     $this->ticketRepository->expects($this->once())->method('getByUniqueId')->with($ticketUniqueId)->will($this->returnValue($ticket));
     $this->templateResolver->expects($this->any())->method('resolve')->will($this->returnValueMap(array(array($notification, TemplateResolver::TYPE_TXT, 'txt.template.html'), array($notification, TemplateResolver::TYPE_HTML, 'html.template.html'))));
     $optionsConstraint = $this->logicalAnd($this->arrayHasKey('changes'), $this->arrayHasKey('attachments'), $this->arrayHasKey('user'), $this->arrayHasKey('header'), $this->contains($notification->getChangeList()), $this->contains($notification->getAttachments()), $this->contains('First Last'), $this->contains($notification->getHeaderText()));
     $this->twig->expects($this->at(0))->method('render')->with('txt.template.html', $optionsConstraint)->will($this->returnValue('Rendered TXT template'));
     $this->twig->expects($this->at(1))->method('render')->with('html.template.html', $optionsConstraint)->will($this->returnValue('Rendered HTML template'));
     $this->mailer->expects($this->once())->method('send')->with($this->logicalAnd($this->isInstanceOf('\\Swift_Message'), $this->callback(function (\Swift_Message $other) use($notification) {
         $to = $other->getTo();
         return false !== strpos($other->getSubject(), $notification->getSubject()) && false !== strpos($other->getSubject(), 'KEY-1') && false !== strpos($other->getBody(), 'Rendered TXT template') && array_key_exists('reporter@host.com', $to) && $other->getHeaders()->has('References') && false !== strpos($other->getHeaders()->get('References'), 'id_1@host.com') && false !== strpos($other->getHeaders()->get('References'), 'id_2@host.com');
     })));
     $this->messageReferenceRepository->expects($this->once())->method('findAllByTicket')->with($ticket)->will($this->returnValue(array(new MessageReference('id_1@host.com', $ticket), new MessageReference('id_2@host.com', $ticket))));
     $this->messageReferenceRepository->expects($this->once())->method('store')->with($this->logicalAnd($this->isInstanceOf('\\Diamante\\DeskBundle\\Model\\Ticket\\EmailProcessing\\MessageReference')));
     $notifier = new EmailNotifier($this->container, $this->twig, $this->mailer, $this->templateResolver, $this->ticketRepository, $this->messageReferenceRepository, $this->userService, $this->nameFormatter, $this->diamanteUserRepository, $this->configManager, $this->oroUserManager, $this->watchersService, $this->senderHost);
     $notifier->notify($notification);
 }
开发者ID:northdakota,项目名称:DiamanteDeskBundle,代码行数:31,代码来源:EmailNotifierTest.php

示例11: testCreateEmailModel

 /**
  * @param $entityClass
  * @param $entityId
  * @param $from
  * @param $subject
  * @param $parentEmail
  * @param $helperDecodeClassNameCalls
  * @param $emGetRepositoryCalls
  * @param $helperPreciseFullEmailAddressCalls
  * @param $helperGetUserCalls
  * @param $helperBuildFullEmailAddress
  *
  * @dataProvider createEmailModelProvider
  *
  * @SuppressWarnings(PHPMD)
  */
 public function testCreateEmailModel($entityClass, $entityId, $from, $subject, $parentEmail, $helperDecodeClassNameCalls, $emGetRepositoryCalls, $helperPreciseFullEmailAddressCalls, $helperGetUserCalls, $helperBuildFullEmailAddress)
 {
     $emailModel = new EmailModel();
     $this->request = new Request();
     $this->request->setMethod('GET');
     if ($entityClass) {
         $this->request->query->set('entityClass', $entityClass);
     }
     if ($entityId) {
         $this->request->query->set('entityId', $entityId);
     }
     if ($from) {
         $this->request->query->set('from', $from);
     }
     if ($subject) {
         $this->request->query->set('subject', $subject);
     }
     $this->emailModelBuilder = new EmailModelBuilder($this->helper, $this->entityManager, $this->configManager, $this->activityListProvider, $this->emailAttachmentProvider, $this->factory);
     $this->emailModelBuilder->setRequest($this->request);
     $this->helper->expects($this->exactly($helperDecodeClassNameCalls))->method('decodeClassName')->willReturn($entityClass);
     $repository = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $this->entityManager->expects($this->exactly($emGetRepositoryCalls))->method('getRepository')->willReturn($repository);
     $this->helper->expects($this->exactly($helperPreciseFullEmailAddressCalls))->method('preciseFullEmailAddress');
     $this->helper->expects($this->exactly($helperGetUserCalls))->method('getUser')->willReturn($this->getMock('Oro\\Bundle\\UserBundle\\Entity\\User'));
     $this->helper->expects($this->exactly($helperBuildFullEmailAddress))->method('buildFullEmailAddress');
     $this->configManager->expects($this->once())->method('get')->with('oro_email.signature');
     $result = $this->emailModelBuilder->createEmailModel($emailModel);
     $this->assertEquals($emailModel, $result);
     $this->assertEquals($entityClass, $result->getEntityClass());
     $this->assertEquals($entityId, $result->getEntityId());
     $this->assertEquals($subject, $result->getSubject());
     $this->assertEquals($from, $result->getFrom());
 }
开发者ID:Maksold,项目名称:platform,代码行数:49,代码来源:EmailModelBuilderTest.php

示例12: testSubmit

 /**
  * @dataProvider submitDataProvider
  *
  * @param array $allowedCurrencies
  * @param string $localeCurrency
  * @param array $inputOptions
  * @param array $expectedOptions
  * @param string $submittedData
  */
 public function testSubmit(array $allowedCurrencies, $localeCurrency, array $inputOptions, array $expectedOptions, $submittedData)
 {
     $hasCustomCurrencies = isset($inputOptions['currencies_list']) || !empty($inputOptions['full_currency_list']);
     $this->configManager->expects($hasCustomCurrencies ? $this->never() : $this->once())->method('get')->with('oro_currency.allowed_currencies')->willReturn($allowedCurrencies);
     $this->localeSettings->expects(count($allowedCurrencies) ? $this->never() : $this->once())->method('getCurrency')->willReturn($localeCurrency);
     $form = $this->factory->create($this->formType, null, $inputOptions);
     $formConfig = $form->getConfig();
     foreach ($expectedOptions as $key => $value) {
         $this->assertTrue($formConfig->hasOption($key));
         $this->assertEquals($value, $formConfig->getOption($key));
     }
     $this->assertNull($form->getData());
     $form->submit($submittedData);
     $this->assertTrue($form->isValid());
     $this->assertEquals($submittedData, $form->getData());
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:25,代码来源:CurrencySelectionTypeTest.php

示例13: testProcessWhenMessageWithoutReferenceWithoutDefaultBranch

 public function testProcessWhenMessageWithoutReferenceWithoutDefaultBranch()
 {
     $message = new Message(self::DUMMY_UNIQUE_ID, self::DUMMY_MESSAGE_ID, self::DUMMY_SUBJECT, self::DUMMY_CONTENT, $this->getDummyFrom(), self::DUMMY_MESSAGE_TO);
     $assigneeId = 1;
     $diamanteUser = $this->getReporter(1);
     $this->userService->expects($this->once())->method('getUserByEmail')->with($this->equalTo(self::DUMMY_MESSAGE_FROM))->will($this->returnValue($diamanteUser));
     $this->configManager->expects($this->once())->method('get')->with($this->equalTo('diamante_desk.default_branch'))->will($this->returnValue(1));
     $this->branchService->expects($this->once())->method('getBranch')->with($this->equalTo(1))->will($this->returnValue($this->defaultBranch));
     $this->defaultBranch->expects($this->any())->method('getDefaultAssigneeId')->will($this->returnValue($assigneeId));
     $reporter = $this->getReporter($diamanteUser->getId());
     $this->messageReferenceService->expects($this->once())->method('createTicket')->with($this->equalTo($message->getMessageId()), self::DUMMY_BRANCH_ID, $message->getSubject(), $message->getContent(), $reporter, $assigneeId);
     $this->ticketStrategy->process($message);
 }
开发者ID:jalopezsuarez,项目名称:diamantedesk-application,代码行数:13,代码来源:TicketStrategyTest.php

示例14: testNotify

 public function testNotify()
 {
     $author = new ApiUser('reporter@host.com', 'password');
     $notification = new UserNotification($author, 'Header');
     $format = '%prefix% %first_name% %middle_name% %last_name% %suffix%';
     $message = new \Swift_Message();
     $this->mailer->expects($this->once())->method('createMessage')->will($this->returnValue($message));
     $this->configManager->expects($this->once())->method('get')->will($this->returnValue('Mike The Bot'));
     $this->nameFormatter->expects($this->any())->method('format')->with($this->diamanteUser)->will($this->returnValue('First Last'));
     $this->userService->expects($this->once())->method('verifyDiamanteUserExists')->with($this->equalTo($author->getEmail()))->will($this->returnValue(1));
     $this->userService->expects($this->once())->method('getByUser')->with($this->equalTo(new UserAdapter(1, UserAdapter::TYPE_DIAMANTE)))->will($this->returnValue($this->diamanteUser));
     $this->nameFormatter->expects($this->once())->method('getNameFormat')->will($this->returnValue($format));
     $this->templateResolver->expects($this->any())->method('resolve')->will($this->returnValueMap(array(array($notification, TemplateResolver::TYPE_TXT, 'txt.template.html'), array($notification, TemplateResolver::TYPE_HTML, 'html.template.html'))));
     $optionsConstraint = $this->logicalAnd($this->arrayHasKey('user'), $this->arrayHasKey('header'), $this->contains('First  Last'), $this->contains($notification->getHeaderText()));
     $this->twig->expects($this->at(0))->method('render')->with('txt.template.html', $optionsConstraint)->will($this->returnValue('Rendered TXT template'));
     $this->twig->expects($this->at(1))->method('render')->with('html.template.html', $optionsConstraint)->will($this->returnValue('Rendered HTML template'));
     $this->mailer->expects($this->once())->method('send')->with($this->logicalAnd($this->isInstanceOf('\\Swift_Message'), $this->callback(function (\Swift_Message $other) use($notification) {
         $to = $other->getTo();
         return false !== strpos($other->getBody(), 'Rendered TXT template') && array_key_exists('reporter@host.com', $to);
     })));
     $notifier = new EmailNotifier($this->twig, $this->mailer, $this->templateResolver, $this->userService, $this->nameFormatter, $this->configManager, $this->senderEmail);
     $notifier->notify($notification);
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:23,代码来源:EmailNotifierTest.php

示例15: testInvalidRoundingTypeException

 /**
  * @throws \OroB2B\Bundle\ProductBundle\Exception\InvalidRoundingTypeException
  */
 public function testInvalidRoundingTypeException()
 {
     $this->configManager->expects($this->once())->method('get')->with('orob2b_product.unit_rounding_type')->willReturn('test');
     $this->setExpectedException('\\OroB2B\\Bundle\\ProductBundle\\Exception\\InvalidRoundingTypeException', 'The type of the rounding is not valid. Allowed the following types: half_up, half_down, ceil, floor.');
     $this->service->round(1.15, 1);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:9,代码来源:RoundingServiceTest.php


注:本文中的Oro\Bundle\ConfigBundle\Config\ConfigManager::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。