<commit_before><?php
namespace tests\BeatSwitch\Lock\Integrations\Laravel;

use BeatSwitch\Lock\Integrations\Laravel\DatabaseDriver;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Database\Schema\Blueprint;
use BeatSwitch\Lock\Tests\PersistentDriverTestCase;

class DatabaseDriverTest extends PersistentDriverTestCase
{
    /**
     * @var \Illuminate\Database\Capsule\Manager
     */
    protected $database;

    /**
     * The name of the table to store the permissions
     *
     * @var string
     */
    protected $table = 'lock_permissions';

    function setUp()
    {
        $this->setupDatabase();

        $this->driver = $this->bootstrapDriver();

        parent::setUp();
    }

    protected function tearDown()
    {
        // Unset the database connection.
        $this->database->getConnection()->disconnect();
        unset($this->database);

        parent::tearDown();
    }

    /**
     * Setup the database
     */
    protected function setupDatabase()
    {
        // Setup the database connection.
        $this->database = new Manager;
        $this->database->addConnection([
            'driver'   => 'sqlite',
            'database' => ':memory:'
        ]);

        // Reset the sqlite database.
        $this->database->getConnection()->getSchemaBuilder()->dropIfExists($this->table);

        // Execute migrations.
        $this->database->getConnection()->getSchemaBuilder()->create($this->table, function (Blueprint $table) {<commit_msg>Removed redundant code with move to in-memory sqlite tests<commit_after><?php
namespace tests\BeatSwitch\Lock\Integrations\Laravel;

use BeatSwitch\Lock\Integrations\Laravel\DatabaseDriver;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Database\Schema\Blueprint;
use BeatSwitch\Lock\Tests\PersistentDriverTestCase;

class DatabaseDriverTest extends PersistentDriverTestCase
{
    /**
     * @var \Illuminate\Database\Capsule\Manager
     */
    protected $database;

    /**
     * The name of the table to store the permissions
     *
     * @var string
     */
    protected $table = 'lock_permissions';

    function setUp()
    {
        $this->setupDatabase();

        $this->driver = $this->bootstrapDriver();

        parent::setUp();
    }

    /**
     * Setup the database
     */
    protected function setupDatabase()
    {
        // Setup the database connection.
        $this->database = new Manager;
        $this->database->addConnection([
            'driver'   => 'sqlite',
            'database' => ':memory:'
        ]);

        // Execute migrations.
        $this->database->getConnection()->getSchemaBuilder()->create($this->table, function (Blueprint $table) {
{'fraction_non_alphanumeric': 0.12918838421444528, 'fraction_numerical': 0.0, 'mean_word_length': 2.6359945872801083, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '3194344', 'n_tokens_mistral': 730, 'n_tokens_neox': 721, 'n_words': 149}