<commit_before><?php
    include_once 'models/user.php';
    include_once 'models/country.php';
    
    class UserTest extends UnitTest {
        public function run() {
            $this->testCreate();
            $this->testDelete();
            $this->testPasswordChange();
            $this->testEmailChange();
            $this->testSetCountry();
            $this->testSetAge();
        }
        public function testCreate() {
            $user = new User();
            $user->username = 'pkakelas';
            $user->password = '<PASSWORD>';
            $user->email = '<EMAIL>';
            $user->save();
            $this->assertEquals( 'pkakelas', $user->username, 'Username must be the one associated during creation' );
            $this->assertEquals( '<EMAIL>', $user->email, 'Email must be the one associated during creation' );
        }
        public function testDelete() {
        }
        public function testPasswordChange() {
            $user = User::findByUsername( 'pkakelas' );
            $password = $user->password;
            $user->password = '<PASSWORD>';
            $user->save();
            if ( $user->authenticatesWithPassword( '<PASSWORD>' ) ) { 
                $success = 1;
            }
            else {
                $success = 0;
            }
            $this->assertEquals( 1, $success, 'Password must be the one associated during update' );<commit_msg>Use intval and add password validation at create<commit_after><?php
    include_once 'models/user.php';
    include_once 'models/country.php';
    
    class UserTest extends UnitTest {
        public function run() {
            $this->testCreate();
            $this->testDelete();
            $this->testPasswordChange();
            $this->testEmailChange();
            $this->testSetCountry();
            $this->testSetAge();
        }
        public function testCreate() {
            $user = new User();
            $user->username = 'pkakelas';
            $user->password = '<PASSWORD>';
            $user->email = '<EMAIL>';
            $user->save();
            $passwordSuccess = intval( $user->authenticatesWithPassword( '<PASSWORD>' ) );
            $this->assertEquals( 1, $passwordSuccess, 'Password must be the one associated during creation' );
            $this->assertEquals( 'pkakelas', $user->username, 'Username must be the one associated during creation' );
            $this->assertEquals( '<EMAIL>', $user->email, 'Email must be the one associated during creation' );
        }
        public function testDelete() {
        }
        public function testPasswordChange() {
            $user = User::findByUsername( 'pkakelas' );
            $password = $user->password;
            $user->password = '<PASSWORD>';
            $user->save();
            $success = intval( $user->authenticatesWithPassword( '<PASSWORD>' ) );
            $this->assertEquals( 1, $success, 'Password must be the one associated during update' );
{'fraction_non_alphanumeric': 0.13881401617250674, 'fraction_numerical': 0.0016846361185983828, 'mean_word_length': 2.0111561866125762, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '77615', 'n_tokens_mistral': 758, 'n_tokens_neox': 748, 'n_words': 190}