From: Rafael Kitover Date: Sat, 29 Oct 2011 18:08:53 +0000 (-0400) Subject: common tests for schema_base_class and components X-Git-Tag: 0.07011~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f104db1e94bd9f6be262a9e3ed319b2a01fe9f5f;p=dbsrgits%2FDBIx-Class-Schema-Loader.git common tests for schema_base_class and components Test calling schema_components methods and test schema_base_class in the common tests. --- diff --git a/t/lib/TestSchemaBaseClass.pm b/t/lib/TestSchemaBaseClass.pm index 82e36dc..dc4e955 100644 --- a/t/lib/TestSchemaBaseClass.pm +++ b/t/lib/TestSchemaBaseClass.pm @@ -13,4 +13,6 @@ sub connection { return $self->next::method(@info); } +sub testschemabaseclass { 'TestSchemaBaseClass works' } + 1; diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 491f24e..88d10a4 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -119,7 +119,7 @@ sub run_tests { $num_rescans++ if $self->{vendor} eq 'Firebird'; plan tests => @connect_info * - (210 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); + (214 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); foreach my $info_idx (0..$#connect_info) { my $info = $connect_info[$info_idx]; @@ -229,6 +229,7 @@ sub setup_schema { qr/^(?:\S+\.)?(?:(?:$self->{vendor}|extra)[_-]?)?loader[_-]?test[0-9]+(?!.*_)/i, result_namespace => RESULT_NAMESPACE, resultset_namespace => RESULTSET_NAMESPACE, + schema_base_class => 'TestSchemaBaseClass', schema_components => [ 'TestSchemaComponent', '+TestSchemaComponentFQN' ], additional_classes => 'TestAdditional', additional_base_classes => 'TestAdditionalBase', @@ -392,9 +393,22 @@ sub test_schema { 'resultset_namespace set correctly on Schema'; like $schema_code, +qr/\nuse base 'TestSchemaBaseClass';\n\n|\nextends 'TestSchemaBaseClass';\n\n/, + 'schema_base_class works'; + + is $conn->testschemabaseclass, 'TestSchemaBaseClass works', + 'schema base class works'; + + like $schema_code, qr/\n__PACKAGE__->load_components\("TestSchemaComponent", "\+TestSchemaComponentFQN"\);\n\n__PACKAGE__->load_namespaces/, 'schema_components works'; + is $conn->dbix_class_testschemacomponent, 'dbix_class_testschemacomponent works', + 'schema component works'; + + is $conn->testschemacomponent_fqn, 'TestSchemaComponentFQN works', + 'fully qualified schema component works'; + my @columns_lt2 = $class2->columns; is_deeply( \@columns_lt2, [ qw/id dat dat2 set_primary_key can dbix_class_testcomponent dbix_class_testcomponentmap testcomponent_fqn meta test_role_method test_role_for_map_method crumb_crisp_coating/ ], "Column Ordering" );