Tripal
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest Class Reference
Inheritance diagram for Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest:
Inheritance graph
[legend]
Collaboration diagram for Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest:
Collaboration graph
[legend]

Public Member Functions

 testTripalImporterForm ()
 
 testTripalImporterFormFiles ()
 
 testTripalImporterFormAnalysis ()
 
 testTripalImporterFormNoButton ()
 
 testTripalImporterFormDisableButtonFormStateOnly ()
 
 testTripalImporterFormDisableButtonAnnotation ()
 

Protected Member Functions

 setUp ()
 
 setMockManager ($annotation)
 

Protected Attributes

 $defaultTheme = 'stark'
 
 $mock_plugin
 
 $definitions
 
 $form
 
 $analysis_form
 

Static Protected Attributes

static $modules = ['system', 'user', 'file', 'tripal']
 

Detailed Description

Tests the base functionality for importers.

Cannot test actually implemented importers as those require database specific implementations.

@group TripalImporter

Member Function Documentation

◆ setMockManager()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::setMockManager (   $annotation)
protected

HELPER: Creates a mock plugin + plugin manager.

◆ setUp()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::setUp ( )
protected

{}

◆ testTripalImporterForm()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterForm ( )

Tests focusing on the Tripal importer form.

◆ testTripalImporterFormAnalysis()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterFormAnalysis ( )

Confirm that the file-related form elements are added to the form as expected based on plugin annotation.

◆ testTripalImporterFormDisableButtonAnnotation()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterFormDisableButtonAnnotation ( )

Confirm that importers can indicate they want the form submit button disabled via annotation and change it via form state.

◆ testTripalImporterFormDisableButtonFormStateOnly()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterFormDisableButtonFormStateOnly ( )

Confirm that importers can indicate they want the form submit button disabled using a particular key in the form state.

◆ testTripalImporterFormFiles()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterFormFiles ( )

Confirm that the file-related form elements are added to the form as expected based on plugin annotation.

◆ testTripalImporterFormNoButton()

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::testTripalImporterFormNoButton ( )

Confirm that importers whose annotation indicates they do not want a submit button, do not get a submit button forced on them.

Member Data Documentation

◆ $analysis_form

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::$analysis_form
protected
Initial value:
= [
'analysis_method' => [
'#title' => 'Gemstone Validation',
'#type' => 'select',
'#description' => 'Choose the validation methodology that proves these stones are authentic.',
'#required' => TRUE,
'#options' => [
'raman' => 'Raman spectroscopy',
'luminescence' => 'Luminescence',
'acid' => 'Acid Testing',
],
'#empty_option' => '- Select -',
],
]

◆ $definitions

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::$definitions
protected
Initial value:
= [
'fakeImporterName' => [
'id' => 'fakeImporterName',
'label' => 'Gemstone Loader',
'description' => 'Imports details on the incredible diversity of gemstones created by our earth into Chado.',
'file_types' => ["gem", "txt"],
'upload_description' => "Please provide a plain text, tab-delimited file of gemstone descriptions making sure to include the details which make them most unique and beautiful.",
'upload_title' => 'Gemstone Descriptions',
'use_analysis' => FALSE,
'require_analysis' => FALSE,
'use_button' => TRUE,
'button_text' => 'Import file',
'file_upload' => FALSE,
'file_load' => FALSE,
'file_remote' => FALSE,
'file_required' => FALSE,
'cardinality' => 1,
],
]

◆ $form

Drupal\Tests\tripal\Kernel\TripalImporterFormBuildTest::$form
protected
Initial value:
= [
'gemstone_composition' => [
'#title' => 'Chemical Composition',
'#type' => 'select',
'#description' => 'Choose the chemical composition that all gems in your input file fall into.',
'#required' => TRUE,
'#options' => [
'borate' => 'Borate (e.g. Howlite)',
'carbon' => 'Carbon (e.g. Diamond)',
'carbonate' => 'Carbonate (e.g. Azurite, Calcite, Malachite)',
'halide' => 'Halide (e.g. Fluorite)',
'igneous' => 'Igneous Rock (e.g. obsidian, lava stone)',
'organic' => 'Organic (e.g. Amber, Pearl)',
'silicate' => 'Silicate (e.g. Amazonite, Danburite, Lepidolite)'
],
'#empty_option' => '- Select -',
],
]

The documentation for this class was generated from the following file: