HEX
Server: Apache
System: Linux karenjy.websitewelcome.com 5.14.0-611.47.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 8 20:00:39 EDT 2026 x86_64
User: codecapperu (2057)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //opt/PUC/t/Module/SQLiteStore/02-create_database.t
#!/usr/bin/env perl
use strict;
use warnings;

use Test::More;
use Test::Exception;
use DBI;

use PUC::Module::WebApp::SQLiteStore;
## no critic (ProhibitConstantPragma)
use constant CLASS => 'PUC::Module::WebApp::SQLiteStore';
## use critic

my $store;
lives_ok {
    $store = CLASS->new( dbfile => ':memory:' );
}
'New memory store';

subtest 'Create the database table' => sub {
    $store->create_local_store;
    my $dbh;
    note 'Connecting to ' . $store->dsn;
    lives_ok {
        $dbh = DBI->connect_cached( $store->dsn );
    }
    'Connection to in-memory database';

    my $r = $dbh->selectrow_hashref( <<'SQL', { RaiseError => 1 } );
        PRAGMA main.table_info('webapps')
SQL

    ok exists( $r->{name} ),
      'First column defined';
    ok $r->{pk},
      'First column is part of primary key';
    ok $r->{notnull},
      'First column is NOT NULL';
};

done_testing;