WC_Mock_WC_Data::get_bool_value PHP Method

get_bool_value() public method

Simple get bool value.
public get_bool_value ( string $context = 'view' ) : boolean
$context string
return boolean
    public function get_bool_value($context = 'view')
    {
        return $this->get_prop('bool_value', $context);
    }

Usage Example

Example #1
0
 /**
  * Test: set_props
  */
 function test_set_props()
 {
     $object = new WC_Mock_WC_Data();
     $data_to_set = array('content' => 'I am a fish', 'bool_value' => true);
     $result = $object->set_props($data_to_set);
     $this->assertFalse(is_wp_error($result));
     $this->assertEquals('I am a fish', $object->get_content());
     $this->assertEquals(true, $object->get_bool_value());
     $data_to_set = array('content' => 'I am also a fish', 'bool_value' => 'thisisinvalid');
     $result = $object->set_props($data_to_set);
     $this->assertTrue(is_wp_error($result));
     $this->assertEquals('I am also a fish', $object->get_content());
     $this->assertNotEquals('thisisinvalid', $object->get_bool_value());
 }