/** * 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()); }