Package DE_EPAGES::Test::API::StoreUnitTest
Base class for unit tests that are run per Store.
Base |
DE_EPAGES::Test::API::UnitTest |
Example |
package MyTest; use base DE_EPAGES::Test::API::StoreUnitTest; use Test::More; use DE_EPAGES::Object::API::Factory qw( LoadRootObject ExistsObjectByPath LoadObjectByPath ); sub init { my $self = shift; $self->SUPER::init; LoadRootObject()->insertChild('Object', { Alias => 'Test' }); } sub test { ok( ExistsObjectByPath('/Test'), 'test object exists' ); is( LoadObjectByPath('/Test')->class->alias, 'Object', 'class of object' ); } sub cleanup { my $self = shift; my $System = LoadRootObject(); LoadObjectByPath('/Test')->delete if ExistsObjectByPath('/Test'); $self->SUPER::cleanup; } MyTest->runScript; use DE_EPAGES::Test::API::StoreUnitTest; use Test::More; use DE_EPAGES::Object::API::Factory qw( ExistsClassByAlias ); DE_EPAGES::Test::API::StoreUnitTest->runScript( sub { ok( ExistsClassByAlias('User'), 'class User exists' ); }}; |
Functions
runScript
Main function to execute the test cases. Initializes error handling and database contexz, then executes the code provided by the $Sub parameter or the method getTestSub.
Syntax |
$Package->runScript; DE_EPAGES::Test::API::StoreUnitTest->runScript( $Sub ); |
Input |
|