<commit_before><?php

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

    public function getModels()
    {
        return array(
            'tests\\Wine',
            'tests\\WineCategory',
        );
    }

    public function testWineRecordCreate()
    {
        $record = new \tests\Wine;
        ok($record);
        $ret = $record->create(array( 'name' => 'Wine Name' ));
        result_ok($ret);
    }

    public function testWineCategoryAndRefer()
    {
        $c = new \tests\WineCategory;
        ok($c,'category');
        $record = new \tests\Wine;
        ok($record);

        $ret = $c->create(array( 'name' => 'Wine Category' ));
        result_ok($ret);

        $ret = $record->create(array( 'name' => "Wine Item" , 'category_id' => $c->id ));
        result_ok($ret);
        
        ok($record->category->id, 'the belongsTo should be generated from refer attribute');
        ok($record->category_id,'the original column');
        is('Wine Category',$record->display('category'));
    }


    public function testJoinedColumnExtractionFromCollection() {
        $c = new \tests\WineCategory;
        ok($c,'category');

        $record = new \tests\Wine;
        ok($record);

        $ret = $c->create(array( 'name' => 'Wine Category' ));
        result_ok($ret);<commit_msg>test generated table name<commit_after><?php

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

    public function getModels()
    {
        return array(
            'tests\\Wine',
            'tests\\WineCategory',
        );
    }

    public function testWineRecordCreate()
    {
        $record = new \tests\Wine;
        ok($record);
        $ret = $record->create(array( 'name' => 'Wine Name' ));
        result_ok($ret);
    }

    public function testWineCategoryAndRefer()
    {
        $c = new \tests\WineCategory;
        ok($c,'category');
        $record = new \tests\Wine;
        ok($record);

        is('wines',$record->getSchema()->getTable() );

        $ret = $c->create(array( 'name' => 'Wine Category' ));
        result_ok($ret);

        $ret = $record->create(array( 'name' => "Wine Item" , 'category_id' => $c->id ));
        result_ok($ret);
        
        ok($record->category->id, 'the belongsTo should be generated from refer attribute');
        ok($record->category_id,'the original column');
        is('Wine Category',$record->display('category'));
    }


    public function testJoinedColumnExtractionFromCollection() {
        $c = new \tests\WineCategory;
        ok($c,'category');

        $record = new \tests\Wine;
        ok($record);

        $ret = $c->create(array( 'name' => 'Wine Category' ));
        result_ok($ret);
{'fraction_non_alphanumeric': 0.16036363636363637, 'fraction_numerical': 0.0, 'mean_word_length': 2.302521008403361, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '4617208', 'n_tokens_mistral': 852, 'n_tokens_neox': 830, 'n_words': 171}