<commit_before><?php

namespace Eotvos\EjtvBundle\Tests\Controller;

use Cancellar\CommonBundle\Test\ModelWebTestCase;

/**
 * Simple tests for the postalcode controller
 * 
 * @uses ModelWebTestCase
 * @author    <NAME> <<EMAIL>> 
 * @copyright 2012 Cancellar
 * @license   MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @version   Release: v0.1
 */
class LayoutTest extends ModelWebTestCase
{
    /**
     * Database setup
     * 
     * @return void
     */
    public function setUp()
    {
        parent::setUp(__DIR__ ."/../TestFixtures");
    }

    public function testRedirect()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/');
        $this->assertTrue($client->getResponse()->isRedirect());
    }

    public function testMenuSize()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/Example%20term/root-page');
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertTrue($crawler->filter('li.main-menu-item')->count() == 4);

    }

    public function testLoginform()
    {
        // should work on multiple pages..
        $targets = array(
            '/Example%20term/root-page',
            '/archives',
            '/Example%20term/szekciok',
        );

        $client = static::createClient();

        foreach ($targets as $target) {
            $client->restart();
            $crawler = $client->request('GET', $target);
            $this->assertTrue($client->getResponse()->isSuccessful());
            $this->assertTrue($crawler->filter('div#login-head')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=password]')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=text]')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=submit]')->count() == 1);

            $form = $crawler->selectButton('loginbtn')->form();
            $crawler = $client->submit($form, array('_username' => '<EMAIL>', '_password' => '<PASSWORD>'));
            $this->assertTrue($client->getResponse()->isRedirect()); // login redirect
            $crawler = $client->followRedirect();
            $this->assertTrue($client->getResponse()->isRedirect('/archives'));
            $crawler = $client->followRedirect();
            $this->assertTrue($client->getResponse()->isSuccessful());
        }
    }

}

<commit_msg>modified test<commit_after><?php

namespace Eotvos\EjtvBundle\Tests\Controller;

use Cancellar\CommonBundle\Test\ModelWebTestCase;

/**
 * Simple tests for the postalcode controller
 * 
 * @uses ModelWebTestCase
 * @author    <NAME> <<EMAIL>> 
 * @copyright 2012 Cancellar
 * @license   MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @version   Release: v0.1
 */
class LayoutTest extends ModelWebTestCase
{
    /**
     * Database setup
     * 
     * @return void
     */
    public function setUp()
    {
        parent::setUp(__DIR__ ."/../TestFixtures");
    }

    public function testRedirect()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/');
        $this->assertTrue($client->getResponse()->isRedirect());
    }

    public function testMenuSize()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/Example%20term/root-page');
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertEquals(4,$crawler->filter('li.main-menu-item')->count());

    }

    public function testLoginform()
    {
        // should work on multiple pages..
        $targets = array(
            '/Example%20term/root-page',
            '/archives',
            '/Example%20term/szekciok',
        );

        $client = static::createClient();

        foreach ($targets as $target) {
            $client->restart();
            $crawler = $client->request('GET', $target);
            $this->assertTrue($client->getResponse()->isSuccessful());
            $this->assertTrue($crawler->filter('div#login-head')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=password]')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=text]')->count() == 1);
            $this->assertTrue($crawler->filter('div#login-head input[type=submit]')->count() == 1);

            $form = $crawler->selectButton('loginbtn')->form();
            $crawler = $client->submit($form, array('_username' => '<EMAIL>', '_password' => '<PASSWORD>'));
            $this->assertTrue($client->getResponse()->isRedirect()); // login redirect
            $crawler = $client->followRedirect();
            $this->assertTrue($client->getResponse()->isRedirect('/archives'));
            $crawler = $client->followRedirect();
            $this->assertTrue($client->getResponse()->isSuccessful());
        }
    }

}


{'fraction_non_alphanumeric': 0.18439573697969033, 'fraction_numerical': 0.006836919364568671, 'mean_word_length': 2.734234234234234, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6677017', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1424, 'n_words': 220}