| 1 | package DBIO::PostgreSQL::EV::TestHarness; | ||
| 2 | # ABSTRACT: Reusable live-PostgreSQL harness for EV async on_connect-replay tests | ||
| 3 | |||
| 4 | 45 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 45 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 45 | our $VERSION = '0.900007'; | |
| 8 | |||
| 9 | 45 | ▶ | use base 'DBIO::Test::AsyncHarness'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | |||
| 12 | 45 | __PACKAGE__->harness_env_prefix('DBIO_TEST_PG'); | |
| 13 | 45 | __PACKAGE__->harness_async_mode('ev'); | |
| 14 | 45 | __PACKAGE__->harness_required_modules([qw( EV EV::Pg )]); | |
| 15 | 45 | __PACKAGE__->harness_schema_class('DBIO::PostgreSQL::EV::TestHarness::_Schema'); | |
| 16 | |||
| 17 | # The default schema class used when the caller supplies none: an ordinary sync | ||
| 18 | # PostgreSQL schema. It declares its driver (core ADR 0067) with the | ||
| 19 | # PostgreSQL component, which pins DBIO::PostgreSQL::Storage, the storage that | ||
| 20 | # registers the 'ev' async mode; no result sources are needed because the | ||
| 21 | # harness exercises connection-level SQL, not the ORM. A schema_class the | ||
| 22 | # caller supplies declares its own driver. | ||
| 23 | # | ||
| 24 | # It loads no component of this distribution: DBIO::PostgreSQL::EV is the | ||
| 25 | # distribution's overview module -- POD, no methods, no connection() hook -- | ||
| 26 | # and a schema reaches the ev mode without it (the distribution's SYNOPSIS | ||
| 27 | # declares the driver with the -pg shortcut and loads no component at all; | ||
| 28 | # t/45-synopsis-plain-schema-live.t runs it). | ||
| 29 | # dbio-mysql-ev's harness loads 'MySQL::EV' as well; the two differ there. That | ||
| 30 | # DBIO::PostgreSQL::EV, loaded as a component, takes no part in resolution is | ||
| 31 | # proven offline -- t/00-load.t's ADR 0032 storage-layer contract, | ||
| 32 | # t/02-access-broker.t's storage_type guard, t/27's registry check. | ||
| 33 | { | ||
| 34 | 45 | package DBIO::PostgreSQL::EV::TestHarness::_Schema; | |
| 35 | 45 | ▶ | use base 'DBIO::Schema'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 45 | __PACKAGE__->load_components('PostgreSQL'); | |
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | 0 | ▶ | sub _tick_loop { |
|
Subroutine
_tick_loop: not called CC=1 SCAR=6.9
| |||
| 41 | 0 | require EV; | |
| 42 | 0 | return EV::run(EV::RUN_ONCE()); | |
| 43 | } | ||
| 44 | |||
| 45 | 45 | 1; | |
| 46 | |||
| 47 | __END__ | ||