Example #1
0
 /**
  * Build the description of the runned `::match()` call.
  *
  * @param mixed $startIndex The startIndex in calls log.
  */
 public function _buildDescription($startIndex = 0)
 {
     $with = $this->_message->args();
     $times = $this->times();
     $report = $this->_report;
     $expectedTimes = $times ? ' the expected times' : '';
     $expectedParameters = $with ? ' with expected parameters' : '';
     $this->_description['description'] = "be called{$expectedParameters}{$expectedTimes}.";
     $calledTimes = count($report['args']);
     $this->_description['data']['actual'] = $this->_actual . '()';
     $this->_description['data']['actual called times'] = $calledTimes;
     if ($calledTimes && $with !== null) {
         $this->_description['data']['actual called parameters list'] = $report['args'];
     }
     $this->_description['data']['expected to be called'] = $this->_actual . '()';
     if ($with !== null) {
         $this->_description['data']['expected parameters'] = $with;
     }
     if ($times) {
         $this->_description['data']['expected called times'] = $times;
     }
 }
 /**
  * Renders the date range field in CMB2.
  *
  * @param object $field         The CMB2 Field Object.
  * @param mixed  $escaped_value The value after being escaped, by default, with sanitize_text_field.
  */
 function render($field, $escaped_value, $field_object_id, $field_object_type, $field_type)
 {
     wp_enqueue_style('jquery-ui-daterangepicker', $this->url . '/assets/jquery-ui-daterangepicker/jquery.comiseo.daterangepicker.css', array(), '0.4.0');
     wp_register_script('moment', $this->url . '/assets/moment.min.js', array(), '2.10.3');
     wp_register_script('jquery-ui-daterangepicker', $this->url . '/assets/jquery-ui-daterangepicker/jquery.comiseo.daterangepicker.js', array('jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-menu', 'jquery-ui-datepicker', 'moment'), '0.4.0');
     wp_enqueue_script('cmb2-daterange-picker', $this->url . '/assets/cmb2-daterange-picker.js', array('jquery-ui-daterangepicker'), self::VERSION, true);
     if (version_compare(CMB2_VERSION, '2.2.2', '>=')) {
         $field_type->type = new CMB2_Type_Text($field_type);
     }
     // CMB2_Types::parse_args allows arbitrary attributes to be added
     $a = $field_type->parse_args('input', array(), array('type' => 'text', 'class' => 'date-range button-secondary', 'name' => $field_type->_name(), 'id' => $field_type->_id(), 'desc' => $field_type->_desc(true), 'data-daterange' => json_encode(array('id' => '#' . $field_type->_id(), 'buttontext' => esc_attr($field_type->_text('button_text', __('Select date range...'))), 'format' => $field->args('date_format') ? $field->args('date_format') : 'mm/dd/yy'))));
     printf('<div class="cmb2-element"><input%s value=\'%s\'/></div>%s', $field_type->concat_attrs($a, array('desc')), json_encode($escaped_value), $a['desc']);
 }