Example #1
0
 /**
  * A basic test that will be called and fail.
  */
 public function testEnableDisableByID()
 {
     $db_prefix = elgg_get_config('dbprefix');
     $annotations = $this->createAnnotations(1);
     $metadata = $this->createMetadata(1);
     foreach ($this->metastringTypes as $type) {
         $id = ${$type}[0];
         $table = $db_prefix . $type;
         $q = "SELECT * FROM {$table} WHERE id = {$id}";
         $test = get_data($q);
         // disable
         $this->assertEqual($test[0]->enabled, 'yes');
         $this->assertTrue(elgg_set_metastring_based_object_enabled_by_id($id, 'no', $type));
         $test = get_data($q);
         $this->assertEqual($test[0]->enabled, 'no');
         // enable
         $ashe = access_get_show_hidden_status();
         access_show_hidden_entities(true);
         flush();
         $this->assertTrue(elgg_set_metastring_based_object_enabled_by_id($id, 'yes', $type));
         $test = get_data($q);
         $this->assertEqual($test[0]->enabled, 'yes');
         access_show_hidden_entities($ashe);
     }
 }
Example #2
0
 /**
  * Disable the metadata
  *
  * @return bool
  * @since 1.8
  */
 function enable()
 {
     return elgg_set_metastring_based_object_enabled_by_id($this->id, 'yes', 'metadata');
 }
Example #3
0
 /**
  * Enable the metadata
  *
  * @return bool
  * @since 1.8
  */
 function enable()
 {
     $success = elgg_set_metastring_based_object_enabled_by_id($this->id, 'yes', 'metadata');
     if ($success) {
         elgg_get_metadata_cache()->markUnknown($this->entity_guid, $this->name);
     }
     return $success;
 }