Beispiel #1
0
 /**
  * Test that we can not get an invalid setting, even if its prefixed with ingot_settings
  *
  * @since 0.2.0
  *
  * @group crud
  * @group settings_crud
  *
  * @covers \ingot\testing\crud\settings::write()
  */
 public function testReadInvalidSetting()
 {
     update_option('ingot_settings_cat', 'dog');
     $read = \ingot\testing\crud\settings::read('cat');
     $this->assertFalse($read);
 }
Beispiel #2
0
 /**
  * Create a response
  *
  * @since 0.2.0
  *
  * @param \WP_REST_Request $request Full data about the request.
  * @param array $settings Optional. Current settings. If not used current settings will be queried
  *
  * @return \WP_Error|\WP_REST_Response
  */
 protected function response($request, $settings = array())
 {
     if (empty($settings)) {
         foreach (array_keys($this->args()) as $setting) {
             $settings[$setting] = \ingot\testing\crud\settings::read($setting);
         }
     }
     if ('admin' == $request->get_param('context')) {
         $valid = false;
         if (ingot_sl_check_license(false)) {
             $valid = true;
         }
         $settings['license_valid'] = (int) $valid;
     }
     return rest_ensure_response($settings);
 }