<commit_before><?php

class BookModelTest extends \LazyRecord\ModelTestCase
{
    public $driver = 'sqlite';

    public function getModels()
    {
        return array( 'tests\BookSchema' );
    }

    public function testImmutableColumn()
    {
        $b = new \tests\Book;
        // $b->autoReload = false;
        result_ok( $b->create(array( 'isbn' => '123123123' )) );
        $ret = $b->update(array('isbn'  => '456456' ));
        ok($ret->error , 'should not update immutable column' ); // should be failed.
        $b->delete();
    }


    /**
     * TODO: Should we validate the field ? think again.
     * @expectedException LazyRecord\DatabaseException
     */
    public function testUpdateUnknownColumn() {
        $b = new \tests\Book;
        // Column not found: 1054 Unknown column 'name' in 'where clause'
        $ret = $b->find(array('name' => 'LoadOrCreateTest'));
        result_fail($ret);
        ok(! $b->id );
    }

    public function testLoadOrCreate() {<commit_msg>Clean up unused code<commit_after><?php

class BookModelTest extends \LazyRecord\ModelTestCase
{
    public $driver = 'sqlite';

    public function getModels()
    {
        return array( 'tests\BookSchema' );
    }

    public function testImmutableColumn()
    {
        $b = new \tests\Book;
        // $b->autoReload = false;
        result_ok( $b->create(array( 'isbn' => '123123123' )) );
        $ret = $b->update(array('isbn'  => '456456' ));
        ok($ret->error , 'should not update immutable column' ); // should be failed.
        $b->delete();
    }


    /**
     * TODO: Should we validate the field ? think again.
     * @expectedException LazyRecord\DatabaseException
     */
    public function testUpdateUnknownColumn() {
        $b = new \tests\Book;
        // Column not found: 1054 Unknown column 'name' in 'where clause'
        $b->find(array('name' => 'LoadOrCreateTest'));
    }

    public function testLoadOrCreate() {
{'fraction_non_alphanumeric': 0.1441025641025641, 'fraction_numerical': 0.019487179487179488, 'mean_word_length': 2.4530973451327434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '7049618', 'n_tokens_mistral': 618, 'n_tokens_neox': 583, 'n_words': 147}