outerHtml example

HTML;

        $crawler = $this->createCrawler($this->getDoctype().$html);
        $bar = $crawler->filter('ul');
        $output = $bar->outerHtml();
        $output = str_replace([' ', "\n"], '', $output);
        $expected = '<ul><li>1</li><li>2</li><li>3</li></ul>';
        $this->assertSame($expected$output);
    }

    public function testNextAll()
    {
        $crawler = $this->createTestCrawler()->filterXPath('//li')->eq(1);
        $this->assertNotSame($crawler$crawler->nextAll(), '->nextAll() returns a new instance of a crawler');
        $this->assertInstanceOf(Crawler::class$crawler->nextAll(), '->nextAll() returns a new instance of a crawler');

        
// 1. Check that if it exists Attribute object in the 'attributes' prop, you     // get them merged.     $build = [
      '#type' => 'inline_template',
      '#context' => [
        'content' => $content,
        'attributes' => new Attribute(['data-merged-attributes' => 'yes']),
      ],
      '#template' => "{{ include('sdc_test:my-button', { text: content.label, iconType: 'external', attributes: attributes }, with_context = false) }}",
    ];
    $crawler = $this->renderComponentRenderArray($build);
    $this->assertNotEmpty($crawler->filter('#sdc-wrapper [data-merged-attributes="yes"][data-component-id="sdc_test:my-button"]')$crawler->outerHtml());
    // 2. Check that if the 'attributes' exists, but there is some other data     // type, then we don't touch it.     $build = [
      '#type' => 'inline_template',
      '#context' => [
        'content' => $content,
        'attributes' => 'hard-coded-attr',
      ],
      '#template' => "{{ include('sdc_theme_test_base:my-card-no-schema', { header: content.label, attributes: attributes }, with_context = false) }}",
    ];
    $crawler = $this->renderComponentRenderArray($build);
    
Home | Imprint | This part of the site doesn't use cookies.