<commit_before><?php

require_once __DIR__.'/../src/SimpleAuth.php';

class Test extends PHPUnit_Framework_TestCase
{
    private $simpleAuth;

    public function __construct()
    {
        $params = array(
        'db_host' => '127.0.0.1',
        'db_user' => 'root',
        'db_password' => '',
        'db_name' => 'simple_auth_test',
        );

        $this->simpleAuth = new SimpleAuth($params);
    }

    public function testCreateUser()
    {
        //Successful:
        $this->assertTrue($this->simpleAuth->createUser('Igor', '<EMAIL>', 'test')['success']);
        //Failed - Same email:
        $this->assertFalse($this->simpleAuth->createUser('Igor', '<EMAIL>', 'test')['success']);
    }

    public function testLogin()
    {
        //Failed: Incorrect Password
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'incorrect')['success']);
        //Failed: Incorrect Email
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'test')['success']);
        //Successful:
        $this->assertTrue($this->simpleAuth->login('<EMAIL>', 'test')['success']);
    }

    public function testUpdatePassword()
    {
        //Failed: Incorrect Email
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'test', 'new_password')['success']);
        //Failed: Incorrect current Password
        $this->assertFalse($this->simpleAuth->updatePassword('<EMAIL>', 'incorrect', '<PASSWORD>')['success']);
        //Successful:
        $this->assertTrue($this->simpleAuth->updatePassword('<EMAIL>', 'test', '<PASSWORD>_password')['success']);
        //Test Login with new password:
        $this->assertTrue($this->simpleAuth->login('<EMAIL>', 'new_password')['success']);
    }

    public function testBruteForce()
    {
        //Lock account:
        for ($i = 0; $i < 6; ++$i) {
            $this->simpleAuth->login('<EMAIL>', 'incorrect');
        }
        //Correct credentials:
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'new_password')['success']);
    }
}<commit_msg>Update test<commit_after><?php

require_once __DIR__.'/../src/SimpleAuth.php';

class Test extends PHPUnit_Framework_TestCase
{
    private $simpleAuth;

    public function __construct()
    {
        $params = array(
        'db_host' => '127.0.0.1',
        'db_user' => 'root',
        'db_password' => '',
        'db_name' => 'simple_auth_test',
        );

        $this->simpleAuth = new SimpleAuth($params);
    }

    public function testCreateUser()
    {
        //Successful:
        $this->assertTrue($this->simpleAuth->createUser('Igor', '<EMAIL>', 'test')['success']);
        //Failed - Same email:
        $this->assertFalse($this->simpleAuth->createUser('Igor', '<EMAIL>', 'test')['success']);
    }

    public function testLogin()
    {
        //Failed: Incorrect Password
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'incorrect')['success']);
        //Failed: Incorrect Email
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'test')['success']);
        //Successful:
        $this->assertTrue($this->simpleAuth->login('<EMAIL>', 'test')['success']);
    }

    public function testUpdatePassword()
    {
        //Failed: Incorrect Email
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', 'test', 'new_password')['success']);
        //Failed: Incorrect current Password
        $this->assertFalse($this->simpleAuth->updatePassword('<EMAIL>', 'incorrect', '<PASSWORD>_password')['success']);
        //Successful:
        $this->assertTrue($this->simpleAuth->updatePassword('<EMAIL>', 'test', 'new_password')['success']);
        //Test Login with new password:
        $this->assertTrue($this->simpleAuth->login('<EMAIL>', 'new_password')['success']);
    }

  /*  public function testBruteForce()
    {
        //Lock account:
        for ($i = 0; $i < 6; ++$i) {
            $this->simpleAuth->login('<EMAIL>', 'incorrect');
        }
        //Correct credentials:
        $this->assertFalse($this->simpleAuth->login('<EMAIL>', '<PASSWORD>')['success']);
    }
    */
}
{'fraction_non_alphanumeric': 0.19916605347068922, 'fraction_numerical': 0.003924454255580083, 'mean_word_length': 2.9553831231813774, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2076555', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1217, 'n_words': 195}