本文整理汇总了PHP中Oro\Bundle\ConfigBundle\Config\ConfigManager::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::flush方法的具体用法?PHP ConfigManager::flush怎么用?PHP ConfigManager::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\ConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRegisterWithoutConfirmation
/**
* @dataProvider registerWithoutConfirmationDataProvider
*
* @param string $email
* @param bool $withPassword
*/
public function testRegisterWithoutConfirmation($email, $withPassword)
{
$this->configManager->set('oro_b2b_account.confirmation_required', false);
$this->configManager->set('oro_b2b_account.send_password_in_welcome_email', $withPassword);
$this->configManager->flush();
$crawler = $this->client->request('GET', $this->getUrl('orob2b_account_frontend_account_user_register'));
$result = $this->client->getResponse();
$this->assertHtmlResponseStatusCodeEquals($result, 200);
$this->submitRegisterForm($crawler, $email);
/** @var MessageDataCollector $collector */
$collector = $this->client->getProfile()->getCollector('swiftmailer');
$messages = $collector->getMessages();
/** @var \Swift_Message $message */
$message = reset($messages);
$this->assertInstanceOf('Swift_Message', $message);
$this->assertEquals($email, key($message->getTo()));
$this->assertContains($email, $message->getSubject());
$this->assertContains($email, $message->getBody());
$this->assertContains(trim($this->configManager->get('oro_ui.application_url'), '/') . $this->getUrl('orob2b_account_account_user_security_login'), $message->getBody());
if ($withPassword) {
$this->assertContains(self::PASSWORD, $message->getBody());
} else {
$this->assertNotContains(self::PASSWORD, $message->getBody());
}
$crawler = $this->client->followRedirect();
$result = $this->client->getResponse();
$this->assertHtmlResponseStatusCodeEquals($result, 200);
$user = $this->getAccountUser(['email' => $email]);
$this->assertNotEmpty($user);
$this->assertTrue($user->isEnabled());
$this->assertTrue($user->isConfirmed());
$this->assertContains('Registration successful', $crawler->html());
}
示例2: testFlush
public function testFlush()
{
$changes = ['oro_user.greeting' => ['value' => 'updated value', 'use_parent_scope_value' => false]];
$this->userScopeManager->expects($this->once())->method('getSettingValue')->with('oro_user.greeting', false)->willReturn('old value');
$beforeEvent = new ConfigSettingsUpdateEvent($this->manager, $changes);
$afterEvent = new ConfigUpdateEvent(['oro_user.greeting' => ['old' => 'old value', 'new' => 'updated value']]);
$this->userScopeManager->expects($this->once())->method('getChanges')->willReturn($changes);
$this->userScopeManager->expects($this->once())->method('save')->with($changes)->willReturn([['oro_user.greeting' => 'updated value'], []]);
$this->dispatcher->expects($this->exactly(2))->method('dispatch');
$this->dispatcher->expects($this->at(0))->method('dispatch')->with(ConfigSettingsUpdateEvent::BEFORE_SAVE, $beforeEvent);
$this->dispatcher->expects($this->at(1))->method('dispatch')->with(ConfigUpdateEvent::EVENT_NAME, $afterEvent);
$this->manager->flush();
}
示例3: onSuccess
/**
* {@inheritdoc}
*/
protected function onSuccess(User $user)
{
$this->manager->updateUser($user);
if ($this->form->has('inviteUser') && $this->form->has('plainPassword') && $this->form->get('inviteUser')->getViewData() && $this->form->get('plainPassword')->getViewData()) {
try {
$this->sendInviteMail($user, $this->form->get('plainPassword')->getViewData()['first']);
} catch (\Exception $ex) {
$this->logger->error('Invitation email sending failed.', ['exception' => $ex]);
$this->flashBag->add('warning', $this->translator->trans('oro.user.controller.invite.fail.message'));
}
}
// Reloads the user to reset its username. This is needed when the
// username or password have been changed to avoid issues with the
// security layer.
// Additional checking for userConfigManager !== null is added because of API
// to avoid "Call to a member function on a non-object".
$this->manager->reloadUser($user);
if ($this->form->has('signature') && $this->userConfigManager !== null) {
$signature = $this->form->get('signature')->getData();
if ($signature) {
$this->userConfigManager->set('oro_email.signature', $signature);
} else {
$this->userConfigManager->reset('oro_email.signature');
}
$this->userConfigManager->flush();
}
}
示例4: testFlush
public function testFlush()
{
$this->userScopeManager->expects($this->once())->method('flush');
$this->manager->flush();
}