#!/usr/bin/perl use strict; use warnings; $|++; use Test::More tests => 11; use lib ('../lib'); use Foo::Test::Engine; my $site = 'dummy'; my $engine = Foo::Test::Engine->new; ok( defined $engine, 'Engine->new should return something' ); ok( $engine->isa('Foo::Test::Engine'), 'and it should be an Engine object' ); ok( $engine->{_template}->isa('Template'), '$engine->{_template} should be a Template object' ); $engine->_process_page; ok ( ! $engine->error, '_process_page successful'.$engine->error ); my $template = $engine->_get_base_template; ok ( defined $template, 'base template is defined' ); like( $engine->headers, qr/Content-Type: text\/html/, "Headers are being created" ); # we're instantiating another engine object because the tests of private # methods have already processed the output, thus creating double output my $engine2 = Foo::Test::Engine->new; my $output = $engine2->output; ok( defined $output, "Looks like we got some output" ); unlike( $output, qr/Template Not Found/, "All templates were found" ); my $output_length = length $output; my $template = $engine2->get_template; ok ($template->isa('Template'), "get_template() should return a 'Template' object"); my $test_output; $template->process( \*DATA, {}, \$test_output ) || die $template->error; like( $test_output, qr/good/, '$test_output should have the word "good" in it'); is( length $output, $output_length, 'Length of $output should not change' ); __DATA__ good