<commit_before><?php
    require_once 'models/error.php';

    class ErrorTest extends UnitTestWithFixtures {
        public function testCreate() {
            $game = $this->buildGame();
            $user = $this->buildUser( 'vitsalis' );
            $error = new Error( $game->id, $user->id, 'error' );
            $error->save();

            $errorObjects = Error::findErrorsByGameAndUser( $game->id, $user->id );
            
            $this->assertTrue( !empty( $errorObjects ), 'An error must be created in the database' );

            $this->assertEquals( 1, count( $errorObjects ), 'The number of errors in the database must be the same as the ones created' );

            $this->assertEquals( 'error', $errorObjects[ 0 ]->error, 'The error in the database must be the one during creation' );
        }
    }

    return new ErrorTest();<commit_msg>Refactor error API to match active record<commit_after><?php
    require_once 'models/error.php';

    class ErrorTest extends UnitTestWithFixtures {
        public function testCreate() {
            $game = $this->buildGame();
            $user = $this->buildUser( 'vitsalis' );
            $error = new Error();
            $error->game = $game;
            $error->user = $user;
            $error->error = 'error';
            $error->save();

            $errorObjects = Error::findErrorsByGameAndUser( $game->id, $user->id );
            
            $this->assertTrue( !empty( $errorObjects ), 'An error must be created in the database' );

            $this->assertEquals( 1, count( $errorObjects ), 'The number of errors in the database must be the same as the ones created' );

            $this->assertEquals( 'error', $errorObjects[ 0 ]->error, 'The error in the database must be the one during creation' );
        }
    }

    return new ErrorTest();
{'fraction_non_alphanumeric': 0.13074398249452954, 'fraction_numerical': 0.002188183807439825, 'mean_word_length': 2.343692870201097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '1742756', 'n_tokens_mistral': 496, 'n_tokens_neox': 485, 'n_words': 158}