Commit d3de62c0a7bbd972dece1e75d187d76aa7e3fcae

Authored by Etienne Pallier
1 parent 40d13554
Exists in master and in 1 other branch dev

pour bugfix tests date sur php5

TESTS.sh
1 1 #!/usr/bin/env bash
2 2  
3 3 TESTEXEC=vendor/bin/phpunit
  4 +TESTEXEC2=vendor/phpunit/phpunit/phpunit
4 5  
5 6 # Tous les tests
6 7 TESTALL=1
... ... @@ -22,7 +23,7 @@ if [[ "$1" != "" ]] ; then
22 23 TESTALL=2
23 24  
24 25 elif [[ $TESTALL == 1 ]] ; then
25   - $TESTEXEC || vendor/phpunit/phpunit/phpunit
  26 + $TESTEXEC || $TESTEXEC2
26 27  
27 28 # Si ca ne marche pas, essayer plutot:
28 29 #vendor/phpunit/phpunit/phpunit
... ...
tests/TestCase/Controller/MaterielsControllerTest.php
... ... @@ -2681,6 +2681,8 @@ class MaterielsControllerTest extends General {
2681 2681 ];
2682 2682 $action = 'edit';
2683 2683 //$this->_doActionAndCheckResult($action, $id, $SUCCESS=true, $new_data);
  2684 + $i = 0;
  2685 + $i++; debug("- test $i");
2684 2686 $this->_doActionAndCheckResult($action, $id, TRUE, $new_data);
2685 2687  
2686 2688  
... ... @@ -2691,15 +2693,19 @@ class MaterielsControllerTest extends General {
2691 2693 $f => '19-04-'.yyyy0,
2692 2694 //'date_reception' => '',
2693 2695 ];
  2696 + $i++; debug("- test $i");
2694 2697 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2695 2698 // - année sur 2 chiffres => KO
2696 2699 $new_data = [ $f => '19/04/'.(yyyy0-2000) ];
  2700 + $i++; debug("- test $i");
2697 2701 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2698 2702 // - date format US AA/MM/DD => KO
2699 2703 $new_data = [ $f => yyyy0.'/04/19' ];
  2704 + $i++; debug("- test $i");
2700 2705 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2701 2706 // - date (achat) incorrecte => KO
2702 2707 $new_data = [ $f => '31/04/'.yyyy0 ];
  2708 + $i++; debug("- test $i");
2703 2709 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2704 2710  
2705 2711  
... ... @@ -2710,23 +2716,27 @@ class MaterielsControllerTest extends General {
2710 2716 $date = $today = new \DateTime('now',$tz);
2711 2717 //debug($date);
2712 2718 $new_data = [ $f => $date->format($format) ];
  2719 + $i++; debug("- test $i");
2713 2720 $this->_doActionAndCheckResult($action, $id, TRUE, $new_data);
2714 2721 // - ... mais date future (demain) => KO
2715 2722 $date = $tomorrow = new \DateTime('+1 days',$tz);
2716 2723 //$date = $tomorrow->add(new \DateInterval('P1D'));
2717 2724 //debug($date);
2718 2725 $new_data = [ $f => $date->format($format) ];
  2726 + $i++; debug("- test $i");
2719 2727 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2720 2728 // - date (achat) loin dans le passé (-40 ans) => OK...
2721 2729 $date = $old = new \DateTime('-40 years',$tz);
2722 2730 //$old = new \DateTime('now',$tz);
2723 2731 //$date = $old->sub(new \DateInterval('P40Y'));
2724 2732 $new_data = [ $f => $date->format($format) ];
  2733 + $i++; debug("- test $i");
2725 2734 $this->_doActionAndCheckResult($action, $id, TRUE, $new_data);
2726 2735 // - mais pas trop loin dans le passé (-50 ans) => KO
2727 2736 $date = $old->sub(new \DateInterval('P10Y'));
2728 2737 //debug($date);
2729 2738 $new_data = [ $f => $date->format($format) ];
  2739 + $i++; debug("- test $i");
2730 2740 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2731 2741  
2732 2742  
... ... @@ -2744,6 +2754,7 @@ class MaterielsControllerTest extends General {
2744 2754 ]
2745 2755 ];
2746 2756 foreach ($dates as $d) {
  2757 + debug("Tests avec date"); debug($d);
2747 2758 //$d1 = 'date_acquisition';
2748 2759 //$d2 = 'date_reception';
2749 2760 $d1 = $d[0];
... ... @@ -2758,6 +2769,7 @@ class MaterielsControllerTest extends General {
2758 2769 $d1 => $today->format($format),
2759 2770 $d2 => $date->format($format)
2760 2771 ];
  2772 + $i++; debug("- test $i.a");
2761 2773 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2762 2774 // - date (reception) = date acq => OK
2763 2775 $date = $today;
... ... @@ -2765,6 +2777,7 @@ class MaterielsControllerTest extends General {
2765 2777 $d1 => $today->format($format),
2766 2778 $d2 => $date->format($format)
2767 2779 ];
  2780 + $i++; debug("- test $i.b");
2768 2781 $this->_doActionAndCheckResult($action, $id, TRUE, $new_data);
2769 2782 // - date (reception) > date_acq (jqa MAX_DIFF - 1 jour) => OK...
2770 2783 /*
... ... @@ -2778,6 +2791,7 @@ class MaterielsControllerTest extends General {
2778 2791 $d1 => $today->format($format),
2779 2792 $d2 => $date->format($format)
2780 2793 ];
  2794 + $i++; debug("- test $i.c");
2781 2795 $this->_doActionAndCheckResult($action, $id, TRUE, $new_data);
2782 2796 // - ...mais pas trop loin dans le futur (MAX_DIFF) => KO
2783 2797 $date = $far->add(new \DateInterval('P1D'));
... ... @@ -2786,6 +2800,7 @@ class MaterielsControllerTest extends General {
2786 2800 $d1 => $today->format($format),
2787 2801 $d2 => $date->format($format)
2788 2802 ];
  2803 + $i++; debug("- test $i.d");
2789 2804 $this->_doActionAndCheckResult($action, $id, FALSE, $new_data);
2790 2805 } // foreach $dates
2791 2806  
... ...