<?php

namespace Bodyrep\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;

class ProfileControllerTest extends WebTestCase
{
    public function testProfile()
    {
        $client = static::createClient();
        $client->followRedirects(true);
        $crawler = $client->request('GET', '/u/login');


        $form = $crawler->selectButton('loginbtn')->form();
        $crawler = $client->submit($form, array(
            '_username' => 'alexl',
            '_password' => 'd559ko54'
        ));


        $crawler = $client->request('GET', '/alexl');

        $this->assertTrue($crawler->filter('html:contains("Alex")')->count() > 0);

    }

    public function testEditProfile()
    {
        $client = static::createClient();
        $client->followRedirects(true);
        $crawler = $client->request('GET', '/u/login');


        $form = $crawler->selectButton('loginbtn')->form();
        $crawler = $client->submit($form, array(
            '_username' => 'alexl',
            '_password' => 'd559ko54'
        ));


        $crawler = $client->request('GET', '/alexl');

        $this->assertTrue($crawler->filter('html:contains("Alex")')->count() > 0);

    }
    
}
?>
