Chris@0: container Chris@0: ->get('entity_type.manager') Chris@0: ->getStorage('block') Chris@0: ->create([ Chris@0: 'id' => 'test_block', Chris@0: 'theme' => 'stark', Chris@0: 'plugin' => 'system_powered_by_block', Chris@0: ]) Chris@0: ->save(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Test callback. Chris@0: */ Chris@0: public function testBlockRendering() { Chris@0: $entity = Block::load('test_block'); Chris@0: Chris@0: $build = \Drupal::entityTypeManager() Chris@0: ->getViewBuilder($entity->getEntityTypeId()) Chris@0: ->view($entity); Chris@0: Chris@0: $content = $this Chris@0: ->container Chris@0: ->get('renderer') Chris@0: ->renderRoot($build); Chris@0: Chris@0: $this->assertTrue( Chris@0: strpos(strip_tags($content), 'Powered by Drupal') !== FALSE, Chris@0: 'Valid block content was found.' Chris@0: ); Chris@0: } Chris@0: Chris@0: }