Ojs\AdminBundle\Tests\Controller\AdminUserControllerTest::testNew PHP Method

testNew() public method

public testNew ( )
    public function testNew()
    {
        $this->logIn();
        $client = $this->client;
        $crawler = $client->request('GET', '/admin/user/new');
        $this->assertStatusCode(200, $client);
        $form = $crawler->filter('form[name=user]')->form();
        $form['user[username]'] = 'UserPhpunit';
        $form['user[password]'] = 'phpunitPassword';
        $form['user[email]'] = '[email protected]';
        $form['user[about]'] = 'User About - phpunit';
        $form['user[title]'] = '1';
        $form['user[firstName]'] = 'First Name - phpunit';
        $form['user[lastName]'] = 'Last Name - phpunit';
        $form['user[enabled]'] = '1';
        $form['user[subjects]'] = ['2'];
        $form['user[avatar]'] = '';
        $form['user[country]'] = '225';
        $crawler = $client->submit($form);
        $this->assertTrue($client->getResponse()->isRedirect());
        $client->followRedirect();
        $this->assertContains('First Name - phpunit', $this->client->getResponse()->getContent());
    }