expects example


        unset(
            $_SERVER[BlueGreenDeploymentService::ENV_NAME],
            $_ENV[BlueGreenDeploymentService::ENV_NAME],
            $_SERVER[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE],
            $_ENV[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE],
        );
    }

    public function testImportDatabaseRedirectsToConfigPageWhenDatabaseConnectionWasNotConfigured(): void
    {
        $this->twig->expects(static::never())
            ->method('render');

        $this->router->expects(static::once())->method('generate')
            ->with('installer.database-configuration', [], UrlGeneratorInterface::ABSOLUTE_PATH)
            ->willReturn('/installer/database-configuration');

        $session = new Session(new MockArraySessionStorage());
        $request = Request::create('/installer/database-import');
        $request->setSession($session);

        $response = $this->controller->databaseImport($request);
        
class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase {

  /** * {@inheritdoc} */
  protected function setupPluginCollection(InvocationOrder $create_count = NULL) {
    $definitions = $this->getPluginDefinitions();
    $this->pluginInstances['apple'] = new ConfigurablePlugin(['id' => 'apple', 'key' => 'value'], 'apple', $definitions['apple']);
    $this->pluginInstances['banana'] = new ConfigurablePlugin(['id' => 'banana', 'key' => 'other_value'], 'banana', $definitions['banana']);

    $create_count = $create_count ?: $this->never();
    $this->pluginManager->expects($create_count)
      ->method('createInstance')
      ->willReturnCallback(function D$id) {
        return $this->pluginInstances[$id];
      });

    $this->defaultPluginCollection = new DefaultSingleLazyPluginCollection($this->pluginManager, 'apple', ['id' => 'apple', 'key' => 'value']);
  }

  /** * Tests the get() method. */
  
return $data;
  }

  /** * Tests fetchFields. */
  public function testFetchFields() {
    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
      ->disableOriginalConstructor()
      ->getMock();
    $views_data->expects($this->once())
      ->method('getAll')
      ->willReturn($this->viewsData());

    $data_helper = new ViewsDataHelper($views_data);

    $expected = [
      'field' => [
        'age',
        'created',
        'job',
        'name',
        

    private InMemoryUserProvider $userProvider;
    private HttpBasicAuthenticator $authenticator;

    protected function setUp(): void
    {
        $this->userProvider = new InMemoryUserProvider();

        $hasherFactory = $this->createMock(PasswordHasherFactoryInterface::class);
        $hasher = $this->createMock(PasswordHasherInterface::class);
        $hasherFactory
            ->expects($this->any())
            ->method('getPasswordHasher')
            ->willReturn($hasher);

        $this->authenticator = new HttpBasicAuthenticator('test', $this->userProvider);
    }

    public function testExtractCredentialsAndUserFromRequest()
    {
        $request = new Request([][][][][][
            'PHP_AUTH_USER' => 'TheUsername',
            'PHP_AUTH_PW' => 'ThePassword',
        ]);

  protected function runMemoryExceededTest($message$memory_exceeded$memory_usage_first = NULL, $memory_usage_second = NULL, $memory_limit = NULL) {
    $this->executable->setMemoryLimit($memory_limit ?: $this->memoryLimit);
    $this->executable->setMemoryUsage($memory_usage_first ?: $this->memoryLimit, $memory_usage_second ?: $this->memoryLimit);
    $this->executable->setMemoryThreshold(0.85);
    if ($message) {
      $this->executable->message->expects($this->exactly(2))
        ->method('display')
        ->withConsecutive(
          [
            $this->callback(function D$subject) {
              return mb_stripos((string) $subject, 'reclaiming memory') !== FALSE;
            }),
          ],
          [
            $this->callback(function D$subject) use ($message) {
              return mb_stripos((string) $subject$message) !== FALSE;
            }),
          ],
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;

class ChainUserProviderTest extends TestCase
{
    public function testLoadUserByIdentifier()
    {
        $provider1 = $this->createMock(InMemoryUserProvider::class);
        $provider1
            ->expects($this->once())
            ->method('loadUserByIdentifier')
            ->with($this->equalTo('foo'))
            ->willThrowException(new UserNotFoundException('not found'))
        ;

        $provider2 = $this->createMock(InMemoryUserProvider::class);
        $provider2
            ->expects($this->once())
            ->method('loadUserByIdentifier')
            ->with($this->equalTo('foo'))
            ->willReturn($account = $this->createMock(UserInterface::class))
        ;

class ElasticsearchEntityAggregatorTest extends TestCase
{
    public function testAggregateWithTimeout(): void
    {
        $criteria = new Criteria();
        $criteria->setLimit(10);

        $client = $this->createMock(Client::class);

        $client->expects(static::once())
            ->method('search')->with([
                'index' => '',
                'body' => [
                    'timeout' => '10s',
                    'size' => 0,
                ],
            ])->willReturn([]);

        $helper = $this->createMock(ElasticsearchHelper::class);
        $helper
            ->method('allowSearch')
            
/** * @internal * * @covers \Shopware\Core\Framework\Plugin\Command\Lifecycle\PluginUpdateAllCommand */
class PluginUpdateAllCommandTest extends TestCase
{
    public function testNoUpdates(): void
    {
        $pluginService = $this->createMock(PluginService::class);
        $pluginService->expects(static::once())->method('refreshPlugins');

        $pluginRepository = new StaticEntityRepository([new PluginCollection([
            $this->createPlugin('Test'),
            $this->createPlugin('Test2'),
        ])]);

        $pluginLifecycleService = $this->createMock(PluginLifecycleService::class);
        $pluginLifecycleService->expects(static::never())->method('updatePlugin');

        $command = new PluginUpdateAllCommand($pluginService$pluginRepository$pluginLifecycleService);
        $command->setHelperSet(new HelperSet());

        
yield [new ChatMessage('Hello!')];
        yield [new DummyMessage()];
    }

    public function testSendWithOptions()
    {
        $messageSubject = 'testMessageSubject';
        $messageContent = 'testMessageContent';

        $response = $this->createMock(ResponseInterface::class);

        $response->expects($this->exactly(2))
            ->method('getStatusCode')
            ->willReturn(200);

        $response->expects($this->once())
            ->method('getContent')
            ->willReturn(json_encode(['status' => 1, 'request' => 'uuid']));

        $expectedBody = http_build_query([
            'message' => 'testMessageContent',
            'title' => 'testMessageSubject',
            'token' => 'appToken',
            


    protected function tearDown(): void
    {
        $this->fs->remove($this->translationDir);
    }

    private function createCommandCompletionTester($extractedMessages = []$loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandCompletionTester
    {
        $translator = $this->createMock(Translator::class);
        $translator
            ->expects($this->any())
            ->method('getFallbackLocales')
            ->willReturn(['en']);

        $extractor = $this->createMock(ExtractorInterface::class);
        $extractor
            ->expects($this->any())
            ->method('extract')
            ->willReturnCallback(
                function D$path$catalogue) use ($extractedMessages) {
                    foreach ($extractedMessages as $domain => $messages) {
                        $catalogue->add($messages$domain);
                    }
$httpCache = new HttpCache($kernel$storeMock, null, ['terminate_on_cache_hit' => false]);
        $httpCache->terminate(Request::create('/')new Response());

        $this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');

        // implements TerminableInterface         $kernelMock = $this->getMockBuilder(Kernel::class)
            ->disableOriginalConstructor()
            ->onlyMethods(['terminate', 'registerBundles', 'registerContainerConfiguration'])
            ->getMock();

        $kernelMock->expects($this->once())
            ->method('terminate');

        $kernel = new HttpCache($kernelMock$storeMock, null, ['terminate_on_cache_hit' => false]);
        $kernel->terminate(Request::create('/')new Response());
    }

    public function testDoesNotCallTerminateOnFreshResponse()
    {
        $terminateEvents = [];

        $eventDispatcher = $this->createMock(EventDispatcher::class);
        
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Http\AccessMapInterface;
use Symfony\Component\Security\Http\Firewall\ChannelListener;

class ChannelListenerTest extends TestCase
{
    public function testHandleWithNotSecuredRequestAndHttpChannel()
    {
        $request = $this->createMock(Request::class);
        $request
            ->expects($this->any())
            ->method('isSecure')
            ->willReturn(false)
        ;

        $accessMap = $this->createMock(AccessMapInterface::class);
        $accessMap
            ->expects($this->any())
            ->method('getPatterns')
            ->with($this->equalTo($request))
            ->willReturn([[], 'http'])
        ;

        

        $obj = new ObjectDummy();
        $object = new \stdClass();
        $obj->setFoo('foo');
        $obj->bar = 'bar';
        $obj->setBaz(true);
        $obj->setCamelCase('camelcase');
        $obj->setObject($object);
        $obj->setGo(true);

        $this->serializer
            ->expects($this->once())
            ->method('normalize')
            ->with($object, 'any')
            ->willReturn('string_object')
        ;

        $this->assertEquals(
            [
                'foo' => 'foo',
                'bar' => 'bar',
                'baz' => true,
                'fooBar' => 'foobar',
                
$criteria->addFilter(new EqualsFilter('name', $this->createTheme($baseTheme)));
        /** @var ThemeEntity $childTheme */
        $childTheme = $this->themeRepository->search($criteria$this->context)->first();
        $this->themeRepository->update([[
            'id' => $childTheme->getId(),
            'technicalName' => null,
        ]]$this->context);

        $_expectedColor = '';
        $_expectedTheme = '';
        $themeCompilerMock = $this->createMock(ThemeCompiler::class);
        $themeCompilerMock->expects(static::exactly(2))
            ->method('compileTheme')
            ->with(
                new IsEqual(TestDefaults::SALES_CHANNEL),
                new Callback(static function Dstring $value) use (&$_expectedTheme): bool {
                    return $value === $_expectedTheme;
                }),
                new Callback(static function DStorefrontPluginConfiguration $value) use (&$_expectedColor): bool {
                    return $value->getThemeConfig()['fields']['sw-color-brand-primary']['value'] === $_expectedColor; /** @phpstan-ignore-line */
                })
            );

        
$this->cache,
            $this->createMock(EntityCacheKeyGenerator::class),
            $this->createMock(AbstractCacheTracer::class),
            $this->eventDispatcher,
            []
        );
    }

    public function testLoadWithDisabledCacheWillCallDecoratedRoute(): void
    {
        $this->decorated
            ->expects(static::once())
            ->method('load')
            ->willReturn($this->response);
        $this->cache
            ->expects(static::never())
            ->method('get');
        $this->eventDispatcher->addListener(
            ProductDetailRouteCacheKeyEvent::class,
            fn (ProductDetailRouteCacheKeyEvent $event) => $event->disableCaching()
        );

        $this->cachedRoute->load('', new Request()$this->context, new Criteria());
    }
Home | Imprint | This part of the site doesn't use cookies.