/[A3C]/t/40-php.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /t/40-php.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 144 by dpavlin, Sat May 31 12:24:04 2008 UTC revision 148 by dpavlin, Tue Jun 3 10:23:52 2008 UTC
# Line 8  test PHP data parser Line 8  test PHP data parser
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 8;  use Jifty::Test tests => 11;
12    
13  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
14    
15  use_ok('A3C::PHP');  use_ok('A3C::PHP');
16    
17    $A3C::PHP::debug = 0; # mostly to prevent "used only once" warning
18  $A3C::PHP::debug = 1 if @ARGV;  $A3C::PHP::debug = 1 if @ARGV;
19    
20  ok( my $data = A3C::PHP->parse( << '__PHP_CONFIG__'  ok( my $data = A3C::PHP->parse( << '__PHP_CONFIG__'
# Line 23  $_bar = "is bar"; Line 24  $_bar = "is bar";
24    
25  $_baz = 'once';  $_baz = 'once';
26  $_baz = "twice";  $_baz = "twice";
27    
28    $double_quoted = "this is \"quoted\" string";
29    $single_quoted = 'and \'another\' one';
30  ?>  ?>
31  __PHP_CONFIG__  __PHP_CONFIG__
32  ), 'parse');  ), 'parse');
33    
34  diag dump( $data );  diag dump( $data );
35  is_deeply( $data, { _foo => 42, _bar => "is bar", _baz => "twice" }, 'correct' );  is_deeply( $data, {
36            _foo => 42,
37            _bar => "is bar",
38            _baz => "twice",
39            double_quoted => 'this is "quoted" string',
40            single_quoted => "and 'another' one",
41    }, 'correct' );
42    
43    ok( my $config = Jifty->config->app('strix'), 'strix config' );
44    ok( my $dir = $config->{dir}, 'found strix dir' );
45    ok( -e $dir, "$dir exists" );
46    
47  sub php2data {  sub php2data {
48          my ( $php_path, $expected ) = @_;          my ( $php_path, $expected ) = @_;
# Line 60  php2data( 't/test.php', Line 74  php2data( 't/test.php',
74    
75  SKIP: {  SKIP: {
76          skip 'need function support', 1;          skip 'need function support', 1;
77          php2data( 'data/strix/etc/cms-qa/conf.php' );          php2data( "$dir/etc/cms-qa/conf.php" );
78  }  }
79    
80  php2data( 'data/strix/etc/new/conf.php',  php2data( "$dir/etc/new/conf.php",
81  {  {
82    _dbname             => "new",    _dbname             => "new",
83    _dbserver           => "localhost",    _dbserver           => "localhost",

Legend:
Removed from v.144  
changed lines
  Added in v.148

  ViewVC Help
Powered by ViewVC 1.1.26