public function test_save_input_value() { $name = 'nom'; $value = 'test'; $id = 'id_form_test'; $post = new \stdClass(); $post->ID = 42; $text = new Text($name, $value, $id); \WP_Mock::wpFunction('get_post', array('times' => 1, 'arg' => array($post->ID), 'return' => $post)); \WP_Mock::wpFunction('update_post_meta', array('times' => 1, 'arg' => array($post->ID, $id, $value), 'return' => 4)); $this->assertNotFalse($text->save($post->ID)); }