phpbb_functional_test_case::create_private_message PHP Method

create_private_message() public method

Be sure to login before creating
public create_private_message ( string $subject, string $message, array $to, array $additional_form_data = [] ) : integer
$subject string
$message string
$to array
$additional_form_data array Any additional form data to be sent in the request
return integer private_message_id
    public function create_private_message($subject, $message, $to, $additional_form_data = array())
    {
        $this->add_lang(array('ucp', 'posting'));
        $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}";
        $form_data = array_merge(array('subject' => $subject, 'message' => $message, 'post' => true), $additional_form_data);
        foreach ($to as $user_id) {
            $form_data['address_list[u][' . $user_id . ']'] = 'to';
        }
        $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data);
        $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text());
        $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri();
        return $this->get_parameter_from_link($url, 'p');
    }