assertIsIterable example


        }

        $errorMessage = 'Expected the following files to have a correct namespace:' . \PHP_EOL . \PHP_EOL . print_r($errors, true);

        static::assertCount(0, $errors$errorMessage);
    }

    public function testNoGlobalExceptionDirectories(): void
    {
        $result = glob(__DIR__ . '/../../*/Exception');
        static::assertIsIterable($result);
        static::assertCount(0, $result, 'No global Exception directories allowed, put your exceptions in the right domain directory, violations: ' . print_r($result, true));
    }

    public function testNoGlobalCommandDirectories(): void
    {
        $result = glob(__DIR__ . '/../../*/Command');
        static::assertIsIterable($result);
        static::assertCount(0, $result, 'No global Command directories allowed, put your commands in the right domain directory, violations: ' . print_r($result, true));
    }

    /** * @param array<string> $basePathParts * * @return array<string> */
$request = new Request([][]['productId' => $product->getId()]);

        /** @var ProductPageLoadedEvent $event */
        $event = null;
        $this->catchEvent(ProductPageLoadedEvent::class$event);

        $page = $this->getPageLoader()->load($request$context);
        $cmsPage = $page->getCmsPage();
        $fieldConfigCollection = new FieldConfigCollection([new FieldConfig('content', 'static', 'overwrittenByProduct')]);

        static::assertNotNull($cmsPage);
        static::assertIsIterable($cmsPage->getSections());
        static::assertNotNull($cmsPage->getSections()->first());
        static::assertIsIterable($cmsPage->getSections()->first()->getBlocks());

        $blocks = $cmsPage->getSections()->first()->getBlocks();
        static::assertInstanceOf(CmsBlockCollection::class$blocks);
        static::assertIsIterable($blocks->getSlots());
        static::assertNotNull($blocks->getSlots()->get($firstSlotId));
        static::assertNotNull($blocks->getSlots()->get($secondSlotId));

        static::assertEquals(
            $productCmsPageData['slotConfig'][$firstSlotId],
            
$assetMapper = $this->createAssetMapper();

        $this->mappedAssetFactory->expects($this->exactly(8))
            ->method('createMappedAsset')
            ->willReturnCallback(function Dstring $logicalPath, string $filePath) {
                $asset = new MappedAsset($logicalPath, publicPath: '/final-assets/'.$logicalPath);

                return $asset;
            });

        $assets = $assetMapper->allAssets();
        $this->assertIsIterable($assets);
        $assets = iterator_to_array($assets);
        $this->assertCount(8, $assets);
        $this->assertInstanceOf(MappedAsset::class$assets[0]);
    }

    public function testGetAssetFromFilesystemPath()
    {
        $assetMapper = $this->createAssetMapper();

        $this->mappedAssetFactory->expects($this->once())
            ->method('createMappedAsset')
            
static::assertInstanceOf(SeoUrlRouteInterface::class$route);

        /** @var \Traversable<SeoUrlEntity> $urls */
        $urls = $this->seoUrlGenerator->generate(
            [$id],
            $template,
            $route,
            $this->salesChannelContext->getContext(),
            $this->salesChannelContext->getSalesChannel()
        );

        static::assertIsIterable($urls);
        static::assertCount($countiterator_to_array($urls, false));
    }

    /** * Checks whether the SEO-URL path generated fits the expected template. * * @dataProvider templateDataProvider */
    public function testGenerateSeoPathInfo(string $template, int $count, string $pathInfo): void
    {
        $id = $this->getValidCategoryId();

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