1 field_permission_example.test | public GenericFieldTest::codeTestGenericRemoveAllFields($node_type = NULL) |
Remove all fields in $this->field_names.
Parameters
mixed $node_type: A content type object. If none is specified, the test fails.
File
- modules/
examples/ field_permission_example/ tests/ field_permission_example.test, line 170 - Tests for Field Permission Example.
Class
- GenericFieldTest
- A generic field testing class.
Code
public function codeTestGenericRemoveAllFields($node_type = NULL) {
if (!$node_type) {
$this->fail('No node type.');
}
if (count($this->instanceNames) < 1) {
$this->fail('There are no instances to remove.');
return;
}
foreach ($this->instanceNames as $instance_name) {
$instance = field_info_instance('node', $instance_name, $node_type->name);
$this->assertTrue($instance, "Instance exists, now we'll delete it.");
field_delete_field($instance_name);
$instance = field_info_instance('node', $instance_name, $node_type->name);
$this->assertFalse($instance, 'Instance was deleted.');
}
$this->instanceNames = array();
}