1 |
#!/usr/bin/perl |
2 |
use strict; |
3 |
use warnings; |
4 |
|
5 |
my $debug = shift @ARGV; |
6 |
|
7 |
use Test::More tests => 14; |
8 |
use lib 'lib'; |
9 |
|
10 |
#use Devel::LeakTrace::Fast; |
11 |
use Data::Dump qw/dump/; |
12 |
|
13 |
BEGIN { |
14 |
use_ok('Strix::View::User'); |
15 |
} |
16 |
|
17 |
ok( my $u = Strix::View::User->new( id => 1, ime => 'foo', prezime => 'bar' ), 'new' ); |
18 |
isa_ok( $u, 'Strix::View::User' ); |
19 |
|
20 |
diag dump( $u ) if $debug; |
21 |
|
22 |
ok( my @c = $u->meta->get_attribute_list , 'get_attribute_list' ); |
23 |
diag dump( @c ) if $debug; |
24 |
|
25 |
#while ( $u = $i->next ) { |
26 |
# isa_ok( $u, 'Strix::View::User' ); |
27 |
#} |
28 |
|
29 |
ok( my $h1 = $u->process(), 'process view/div' ); |
30 |
diag $h1 if $debug; |
31 |
like( $h1, qr|<div class="view">|, 'div view' ); |
32 |
|
33 |
$u->render_as('edit'); |
34 |
ok( my $h2 = $u->process(), 'process edit/div' ); |
35 |
diag $h2 if $debug; |
36 |
like( $h2, qr|<div class="editform">|, 'div editform' ); |
37 |
|
38 |
cmp_ok( $h1, 'ne', $h2, 'view and edit differs' ); |
39 |
|
40 |
$u->render_as('view'); |
41 |
$u->_layout('table'); |
42 |
ok( my $h3 = $u->process(), 'process view/table' ); |
43 |
diag $h3 if $debug; |
44 |
like( $h3, qr|<tr>|, 'tr' ); |
45 |
|
46 |
$u->render_as('edit'); |
47 |
ok( my $h4 = $u->process(), 'process edit/table' ); |
48 |
diag $h4 if $debug; |
49 |
like( $h4, qr|<tr>|, 'tr' ); |
50 |
|
51 |
cmp_ok( $h3, 'ne', $h4, 'view and edit differs' ); |
52 |
|