CommentEntityFormDisplaySubjectTest.php in Commerce Migrate 8.2        
                          
                  
                        
  
  
  
  
File
  modules/ubercart/tests/src/Kernel/Migrate/uc7/CommentEntityFormDisplaySubjectTest.php
  
    View source  
  <?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
class CommentEntityFormDisplaySubjectTest extends Ubercart7TestBase {
  
  public static $modules = [
    'comment',
    'commerce_price',
    'commerce_product',
    'commerce_store',
    'node',
    'path',
    'text',
  ];
  
  protected function setUp() {
    parent::setUp();
    $this
      ->installEntitySchema('commerce_product');
    $this
      ->installConfig([
      'comment',
      'commerce_product',
      'node',
    ]);
    $this
      ->executeMigrations([
      'uc7_comment_type',
      'uc7_comment_entity_form_display_subject',
    ]);
  }
  
  protected function assertSubjectVisible($id) {
    $component = EntityFormDisplay::load($id)
      ->getComponent('subject');
    $this
      ->assertInternalType('array', $component);
    $this
      ->assertSame('string_textfield', $component['type']);
    $this
      ->assertSame(10, $component['weight']);
  }
  
  protected function assertSubjectNotVisible($id) {
    $component = EntityFormDisplay::load($id)
      ->getComponent('subject');
    $this
      ->assertNull($component);
  }
  
  public function testMigration() {
    $this
      ->assertSubjectVisible('comment.comment_node_product.default');
    $this
      ->assertSubjectVisible('comment.comment_node_entertainment.default');
  }
}