Fix borked tests
[dbsrgits/DBIx-Class-Tree.git] / t / 10_adjacencylist.t
index 42b80cf..61fe503 100644 (file)
@@ -4,13 +4,19 @@ use warnings;
 use lib 't/lib';
 
 use Test::More;
-use TreeTest;
 
-TreeTest::Schema::Node->load_components(qw(
+BEGIN {   # This must happen before the schema is loaded
+
+  require TreeTest::Schema::Node;
+
+  TreeTest::Schema::Node->load_components(qw(
     Tree::AdjacencyList
-));
+  ));
 
-TreeTest::Schema::Node->parent_column( 'parent_id' );
+  TreeTest::Schema::Node->parent_column( 'parent_id' );
+}
+
+use TreeTest;
 
 my $tests = TreeTest::count_tests();
 plan tests => $tests;