Filewatcher File Search File Search
Catalog
Content Search
» » » » » Test-Double-0.01.tar.gz » Content »
pkg://Test-Double-0.01.tar.gz:21927/Test-Double-0.01/  info  downloads

README

NAME
    Test::Double - Perl extension for Test Double.

SYNOPSIS
      package Foo;
      sub new { bless {}, shift }
      sub bar { 'bar' }
  
      # in your tests
      use Test::More;
      use Test::Double;
  
      my $foo = Foo->new;
      is $foo->bar, 'bar', 'bar() returns "bar"';
  
      # stub out
      stub($foo)->bar('BAR');
      is $foo->bar, 'BAR', 'stubbed bar() returns "BAR"';
  
      # mock out
      mock($foo)->expects('bar')->returns('BAR');
      is $foo->bar, 'BAR', 'mocked bar() returns 'BAR';
  
      done_testing;

DESCRIPTION
    Test::Double is a Perl extension for Test Double.

METHODS
    stub($object)
        Returns stub object. This object accepts any methods for stubbing
        using AUTOLOAD mechanism.

          stub($object)->some_method($expected_value);
          # after, $object->some_method() returns $expected_value

        See <http://xunitpatterns.com/Test%20Stub.html>

    mock($object)
        Returns mock object. This object can be defined expectation by
        calling expects() method.

          mock($object)->expects('some_method');
          # after, $object->some_method() returns $expected_value

        See Test::Double::Mock

AUTHOR
    NAKAGAWA Masaki <masaki@cpan.org>

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

SEE ALSO
    <http://xunitpatterns.com/Test%20Double.html>

Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com