Bolt\Tests\Controller\Backend\UsersTest::testProfile PHP Метод

testProfile() публичный Метод

public testProfile ( )
    public function testProfile()
    {
        // Symfony forms need a CSRF token so we have to mock this too
        $this->removeCSRF($this->getApp());
        $user = $this->getService('users')->getUser(1);
        $this->setSessionUser(new Entity\Users($user));
        $this->setRequest(Request::create('/bolt/profile'));
        $response = $this->controller()->profile($this->getRequest());
        $context = $response->getContext();
        $this->assertEquals('@bolt/edituser/edituser.twig', $response->getTemplate()->getTemplateName());
        $this->assertEquals('profile', $context['context']['kind']);
        // Now try a POST to update the profile
        $this->setRequest(Request::create('/bolt/profile', 'POST', ['form' => ['id' => 1, 'password' => '', 'password_confirmation' => '', 'email' => $user['email'], 'displayname' => 'Admin Test', '_token' => 'xyz']]));
        $this->controller()->profile($this->getRequest());
        $this->assertNotEmpty($this->getFlashBag()->get('success'));
    }