Tripal
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest Class Reference
Inheritance diagram for Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest:
Inheritance graph
[legend]
Collaboration diagram for Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest:
Collaboration graph
[legend]

Public Member Functions

 testStoreActionAlias ()
 
 testStoreActionDeleteIfEmpty ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $fields = []
 
 $yaml_file = __DIR__ . "/ChadoStorageActions-FieldDefinitions.yml"
 
int $feature_id
 

Additional Inherited Members

- Public Attributes inherited from Drupal\Tests\tripal_chado\Kernel\ChadoTestKernelBase
const SCHEMA_NAME_ONLY = 0
 
const CREATE_SCHEMA = 1
 
const INIT_DUMMY = 2
 
const INIT_CHADO_EMPTY = 3
 
const INIT_CHADO_DUMMY = 4
 
const PREPARE_TEST_CHADO = 5
 
- Static Protected Attributes inherited from Drupal\Tests\tripal_chado\Kernel\ChadoTestKernelBase
static $modules = ['tripal', 'tripal_biodb', 'tripal_chado']
 

Detailed Description

Tests that specific ChadoStorage actions perform as expected.

NOTE: The store action is actually tested fairly well as part of the testing for other actions. Specifically, pretty much every action test includes a store property and the value of that property is checked alongside the other properties as a way to confirm that the full record loaded properly. This was especially necessary for the store_* actions since they are set before loading so checking the store property is needed to ensure the record was actually loaded based on the pre-set keys.

Anyway, as such, this class only focuses on testing edge cases like alias use and the delete_if_empty setting.

@group Tripal @group Tripal Chado @group ChadoStorage @group ChadoStorage Actions

Member Function Documentation

◆ setUp()

Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest::setUp ( )
protected

◆ testStoreActionAlias()

Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest::testStoreActionAlias ( )

Test the store action when an alias is set and it's on a non-base table.

Chado Table: featureprop Columns: featureprop_id*, feature_id*, type_id*, value, rank*

Specifically, ensure that a property with the store action

  • can be inserted when an alias is used on a non-base table
  • can be loaded when an alias is used on a non-base table
  • can be updated when an alias is used on a non-base table

This is not an easy check since ChadoStorage deletes all these records and recreates them... hense the primary keys are incremented and do not remain constant. print_r($records); $query = $this->chado_connection->select('1:featureprop', 'prop') ->fields('prop', ['rank']) ->condition('prop.featureprop_id', $test_store_other_alias_pkeys[1], '=') ->execute(); $ret_rank = $query->fetchField(); $this->assertEquals(1, $ret_rank, "The rank does not seem to have been updated as we expected.");

◆ testStoreActionDeleteIfEmpty()

Drupal\Tests\tripal_chado\Kernel\Plugin\ChadoStorage\ChadoStorageActions_StoreTest::testStoreActionDeleteIfEmpty ( )

Test the store action delete_if_empty on insert and update.

Chado Table: featureprop Columns: featureprop_id*, feature_id*, type_id*, value*, rank*

Specifically, ensure that a property with the store action

  • is deleted if it's an empty string and delete_if_empty is true
  • is kept and inserted as an empty string if delete_if_empty is false

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