<commit_before><?php

require 'DatabaseTest.php';

use Thaumatic\Junxa;
use Thaumatic\Junxa\Exceptions\JunxaNoSuchTableException;

class BasicInteractionTest
    extends DatabaseTest
{

    private function runBasicInteractionTests($db)
    {
        $this->assertInstanceOf('Thaumatic\Junxa', $db);
        $categoryTable = $db->category;
        $this->assertInstanceOf('Thaumatic\Junxa\Table', $categoryTable);
        $this->assertSame('category', $categoryTable->name());
        $itemTable = $db->item;
        $this->assertInstanceOf('Thaumatic\Junxa\Table', $itemTable);
        $this->assertSame('item', $itemTable->name());
        $categoryTableIdColumn = $categoryTable->id;
        $this->assertInstanceOf('Thaumatic\Junxa\Column', $categoryTableIdColumn);
        $this->assertSame('id', $categoryTableIdColumn->name());
    }

    public function testWithArraySetup()
    {
        $db = new Junxa([
            'hostname'  => 'localhost',
            'database'  => DatabaseTest::TEST_DATABASE_NAME,
        ]);
        $this->runBasicInteractionTests($db);
    }

    public function testWithFluentSetup()
    {
        $db = Junxa::make()
            ->setHostname('localhost')
            ->setDatabase(DatabaseTest::TEST_DATABASE_NAME)
            ->ready()
        ;
        $this->runBasicInteractionTests($db);
    }

}<commit_msg>start on insert tests, update method names<commit_after><?php

require 'DatabaseTest.php';

use Thaumatic\Junxa;
use Thaumatic\Junxa\Exceptions\JunxaNoSuchTableException;
use Thaumatic\Junxa\Query as Q;

class BasicInteractionTest
    extends DatabaseTest
{

    public function testWithArraySetup()
    {
        $db = new Junxa([
            'hostname'  => 'localhost',
            'database'  => DatabaseTest::TEST_DATABASE_NAME,
        ]);
        $this->runBasicInteractionTests($db);
        $this->runInsertTests($db);
    }

    public function testWithFluentSetup()
    {
        $db = Junxa::make()
            ->setHostname('localhost')
            ->setDatabase(DatabaseTest::TEST_DATABASE_NAME)
            ->ready()
        ;
        $this->runBasicInteractionTests($db);
        $this->runInsertTests($db);
    }

    private function runBasicInteractionTests($db)
    {
        $this->assertInstanceOf('Thaumatic\Junxa', $db);
        $categoryTable = $db->category;
        $this->assertInstanceOf('Thaumatic\Junxa\Table', $categoryTable);
        $this->assertSame('category', $categoryTable->getName());
        $itemTable = $db->item;
        $this->assertInstanceOf('Thaumatic\Junxa\Table', $itemTable);
        $this->assertSame('item', $itemTable->getName());
        $categoryTableIdColumn = $categoryTable->id;
        $this->assertInstanceOf('Thaumatic\Junxa\Column', $categoryTableIdColumn);
        $this->assertSame('id', $categoryTableIdColumn->getName());
    }

    private function runInsertTests($db)
    {
        $category = $db->category->row();
        $category->name = 'Uncategorized';
        $category->created_at = Q::func('NOW');
        $category->insert();
    }

}
{'fraction_non_alphanumeric': 0.14579256360078277, 'fraction_numerical': 0.0, 'mean_word_length': 2.97279792746114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, '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': '7564839', 'n_tokens_mistral': 934, 'n_tokens_neox': 905, 'n_words': 130}