isGlobal example

    // and compare with AuthenticationCollector::getSortedProviders().     krsort($providers);

    // Merge nested providers from $providers into $sorted_providers.     $sorted_providers = array_merge(...$providers);
    $this->assertEquals($sorted_providers$authentication_collector->getSortedProviders());

    // Test AuthenticationCollector::getProvider() and     // AuthenticationCollector::isGlobal().     foreach ($sorted_providers as $provider) {
      $this->assertEquals($provider$authentication_collector->getProvider($provider->providerId));
      $this->assertEquals($global[$provider->providerId]$authentication_collector->isGlobal($provider->providerId));
    }
  }

}

/** * A simple provider for unit testing AuthenticationCollector. */
class TestAuthenticationProvider implements AuthenticationProviderInterface {

  /** * The provider id. * * @var string */
$relatedEntities = array_map(fn (CustomFieldSetRelationEntity $relation) => $relation->getEntityName()$relations->getElements());
        static::assertContains('product', $relatedEntities);
        static::assertContains('customer', $relatedEntities);

        static::assertEquals([
            'label' => [
                'en-GB' => 'Custom field test',
                'de-DE' => 'Zusatzfeld Test',
            ],
            'translated' => true,
        ]$customFieldSet->getConfig());
        static::assertTrue($customFieldSet->isGlobal());

        $customFieldCollection = $customFieldSet->getCustomFields();
        static::assertInstanceOf(CustomFieldCollection::class$customFieldCollection);

        static::assertCount(2, $customFieldCollection);

        $fieldWithoutAllowWrite = $customFieldCollection->filterByProperty('name', 'bla_test')->first();
        static::assertInstanceOf(CustomFieldEntity::class$fieldWithoutAllowWrite);

        static::assertFalse($fieldWithoutAllowWrite->isAllowCustomerWrite());

        

  protected function defaultFilter(Request $request$provider_id) {
    $route = RouteMatch::createFromRequest($request)->getRouteObject();
    $has_auth_option = isset($route) && $route->hasOption('_auth');

    if ($has_auth_option) {
      return in_array($provider_id$route->getOption('_auth'));
    }
    else {
      return $this->authCollector->isGlobal($provider_id);
    }
  }

}
Home | Imprint | This part of the site doesn't use cookies.