Give_Donate_Form::get_goal PHP Method

get_goal() public method

Retrieve the goal
Since: 1.0
public get_goal ( ) : float
return float Goal.
    public function get_goal()
    {
        if (!isset($this->goal)) {
            $this->goal = get_post_meta($this->ID, '_give_set_goal', true);
            if ($this->goal) {
                $this->goal = give_sanitize_amount($this->goal);
            } else {
                $this->goal = 0;
            }
        }
        return apply_filters('give_get_set_goal', $this->goal, $this->ID);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Test Set Goal
  *
  * @covers Give_Donate_Form::get_goal
  */
 public function test_get_goal()
 {
     $simple_form = new Give_Donate_Form($this->_simple_form->ID);
     $this->assertEquals(0, $simple_form->get_goal());
     update_post_meta($simple_form->ID, '_give_set_goal', 5000);
     $simple_form = new Give_Donate_Form($this->_simple_form->ID);
     $this->assertEquals(5000, $simple_form->get_goal());
 }