16 # construct the schema object 20 self::$TestFieldIds = array();
22 # outline fields to be created 23 self::$TestFields = array(
28 foreach (self::$TestFields as $FieldName => $FieldType)
30 $TmpField = $Schema->GetItemByName($FieldName);
31 if ($TmpField === NULL)
33 $TmpField = $Schema->AddField($FieldName, $FieldType);
35 $TmpField->IsTempItem(FALSE);
36 self::$TestFieldIds[$FieldName] = $TmpField->Id();
47 # construct the schema object 52 # drop all of the test fields 53 foreach (self::$TestFieldIds as $FieldName => $FieldId)
55 $Schema->DropField($FieldId);
57 # remove from OAIFieldMappings too 59 DELETE FROM OAIFieldMappings 60 WHERE SPTFieldId = " . addslashes($FieldId));
67 $MyId = self::$TestFieldIds[
'ControlledNameTestField'];
71 NULL,
"TestName", $MyId);
72 $this->assertInstanceOf(
73 ControlledName::class, $TestName);
75 $TestName->FieldId(), $MyId);
77 $TestName->Name(),
"TestName");
81 $TestName->InUse(), 0);
83 $TestName->GetAssociatedResources(), array() );
87 array($TestName->Id()),
91 # Create a duplicate of the name 93 NULL,
"TestName", $MyId);
97 $TestDup->Id(), $TestName->Id() );
99 # Create an invalid name 105 $TestName->Delete(TRUE);
static SearchForControlledName($ControlledName, $FieldId)
Check if the given controlled name already exists for a given field ID.
SQL database abstraction object with smart query caching.
Metadata type representing non-hierarchical controlled vocabulary values.
const STATUS_OK
Successful execution.
const STATUS_INVALID_ID
No ControlledName exists with specified ID.
static tearDownAfterClass()
After to running the tests, this function is run.
const STATUS_EXISTS
ControlledName already exists with this term.
static setUpBeforeClass()
Prior to running any of the tests, this function is run.