summaryrefslogtreecommitdiff
path: root/t/99-versioning.t
blob: d1b833c58f783513146f26d7f16566d5c583a7ae (plain)
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Test::More tests => 17;
  5. use LedgerSMB;
  6. use LedgerSMB::Form;
  7. my $lsmb = new LedgerSMB;
  8. ok(defined $lsmb, 'lsmb: defined');
  9. isa_ok($lsmb, 'LedgerSMB', 'lsmb: correct type');
  10. ok(defined $lsmb->{version}, 'lsmb: version set');
  11. ok(defined $lsmb->{dbversion}, 'lsmb: dbversion set');
  12. my $form = new Form;
  13. ok(defined $form, 'form: defined');
  14. isa_ok($form, 'Form', 'form: correct type');
  15. ok(defined $form->{version}, 'form: version set');
  16. ok(defined $form->{dbversion}, 'form: dbversion set');
  17. is($lsmb->{version}, $form->{version}, 'LedgerSMB and Form versions match');
  18. is($lsmb->{dbversion}, $form->{dbversion}, 'LedgerSMB and Form dbversions match');
  19. ok(-e 'VERSION', 'VERSION exists');
  20. ok(-s 'VERSION', 'VERSION non-empty');
  21. ok(-r 'VERSION', 'VERSION readable');
  22. open(my $FH, '<', 'VERSION');
  23. my $ver = readline $FH;
  24. close $FH;
  25. chomp $ver;
  26. is($lsmb->{version}, $ver, 'LedgerSMB version matches VERSION');
  27. is($form->{version}, $ver, 'Form version matches VERSION');
  28. SKIP: {
  29. skip 'LedgerSMB is trunk', 1 if $lsmb->{version} =~ /trunk$/i;
  30. cmp_ok($lsmb->{version}, 'ge', $lsmb->{dbversion},
  31. 'lsmb: version >= dbversion');
  32. }
  33. SKIP: {
  34. skip 'Form is trunk', 1 if $form->{version} =~ /trunk$/i;
  35. cmp_ok($form->{version}, 'ge', $form->{dbversion},
  36. 'form: version >= dbversion');
  37. }