phpbb_functional_test_case::submit_post PHP Method

submit_post() protected method

Helper for submitting posts
protected submit_post ( string $posting_url, string $posting_contains, array $form_data, string $expected = '' ) : array | null
$posting_url string
$posting_contains string
$form_data array
$expected string Lang var of expected message after posting
return array | null post_id, topic_id if message is empty
    protected function submit_post($posting_url, $posting_contains, $form_data, $expected = '')
    {
        $this->add_lang('posting');
        $crawler = $this->submit_message($posting_url, $posting_contains, $form_data);
        if ($expected !== '') {
            if (isset($this->lang[$expected])) {
                $this->assertContainsLang($expected, $crawler->filter('html')->text());
            } else {
                $this->assertContains($expected, $crawler->filter('html')->text());
            }
            return null;
        }
        $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
        return array('topic_id' => $this->get_parameter_from_link($url, 't'), 'post_id' => $this->get_parameter_from_link($url, 'p'));
    }