[Catalyst] unit testing with MockObject

Daniel McBrearty danielmcbrearty at gmail.com
Sat Jun 3 17:22:02 CEST 2006


that doesn't seem to do it either.

here's the top of my test file :

use strict;
use warnings;
use Test::WWW::Mechanize::Catalyst 'Engoi';
use Test::MockObject;
use Test::More tests => 3;
use Data::Dumper;

BEGIN {
    my $mock = Test::MockObject->new;
    #Engoi->components->{'Controller::Public'} = $mock;
    $mock->fake_module('Engoi::Controller::Public');
    $mock->set_true('home');
    use_ok('Catalyst::Test', 'Engoi');
}

I've tried various combinationsof those lines in the BEGIN block ...

anyone got any ideas? or some example code that works?



On 6/3/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Daniel McBrearty wrote:
> > I am doing this :
> >
> > my $mock = Test::MockObject->new;
> > $mock->fake_module('Engoi::Controller::Public');
> > $mock->set_true('home');
> >
> > almost the first thing in the test file.
> >
> > Later I do a get on /public/home, but the method in the real
> > controller still gets called.
>
> Engoi->components->{Controller::Public} = $mock;
>
> maybe
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>


-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131



More information about the Catalyst mailing list