unableGenerateBundle example


        $assets = [];
        $package = $this->packages->getPackage('asset');

        foreach ($this->kernel->getBundles() as $bundle) {
            if (!$bundle instanceof Bundle) {
                continue;
            }

            $bundleDirectoryName = preg_replace('/bundle$/', '', mb_strtolower($bundle->getName()));
            if ($bundleDirectoryName === null) {
                throw ApiException::unableGenerateBundle($bundle->getName());
            }

            $styles = array_map(static function Dstring $filename) use ($package$bundleDirectoryName) {
                $url = 'bundles/' . $bundleDirectoryName . '/' . $filename;

                return $package->getUrl($url);
            }$this->getAdministrationStyles($bundle));

            $scripts = array_map(static function Dstring $filename) use ($package$bundleDirectoryName) {
                $url = 'bundles/' . $bundleDirectoryName . '/' . $filename;

                
public function testShippingCostsParameterIsMissing(): void
    {
        $exception = ApiException::shippingCostsParameterIsMissing();

        static::assertEquals(ApiException::API_SHIPPING_COSTS_PARAMETER_IS_MISSING, $exception->getErrorCode());
        static::assertEquals('Parameter "shippingCosts" is missing.', $exception->getMessage());
    }

    public function testUnableGenerateBundle(): void
    {
        $exception = ApiException::unableGenerateBundle('bundleName');

        static::assertEquals(ApiException::API_UNABLE_GENERATE_BUNDLE, $exception->getErrorCode());
        static::assertEquals('Unable to generate bundle directory for bundle "bundleName".', $exception->getMessage());
    }

    public function testInvalidSchemaDefinitions(): void
    {
        $exception = ApiException::invalidSchemaDefinitions('file', new \JsonException());

        static::assertEquals(ApiException::API_INVALID_SCHEMA_DEFINITION_EXCEPTION, $exception->getErrorCode());
    }

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