@@ -2696,143 +2696,145 @@ public function testWithFileReversedRange()
2696
2696
/**
2697
2697
* testFileRangeOffsetsNoDownload method
2698
2698
*
2699
+ * @group deprecated
2699
2700
* @dataProvider rangeProvider
2700
2701
* @return void
2701
2702
*/
2702
2703
public function testFileRangeOffsetsNoDownload ($ range , $ length , $ offsetResponse )
2703
2704
{
2704
- $ _SERVER ['HTTP_RANGE ' ] = $ range ;
2705
- $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2706
- ->setMethods ([
2707
- 'header ' ,
2708
- 'type ' ,
2709
- '_sendHeader ' ,
2710
- '_isActive ' ,
2711
- ])
2712
- ->getMock ();
2705
+ $ this ->deprecated (function () use ($ range , $ length , $ offsetResponse ) {
2706
+ $ _SERVER ['HTTP_RANGE ' ] = $ range ;
2707
+ $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2708
+ ->setMethods ([
2709
+ 'header ' ,
2710
+ 'type ' ,
2711
+ '_sendHeader ' ,
2712
+ '_isActive ' ,
2713
+ ])
2714
+ ->getMock ();
2713
2715
2714
- $ response ->expects ($ this ->at (1 ))
2715
- ->method ('header ' )
2716
- ->with ('Accept-Ranges ' , 'bytes ' );
2716
+ $ response ->expects ($ this ->at (1 ))
2717
+ ->method ('header ' )
2718
+ ->with ('Accept-Ranges ' , 'bytes ' );
2717
2719
2718
- $ response ->expects ($ this ->at (2 ))
2719
- ->method ('header ' )
2720
- ->with ([
2721
- 'Content-Length ' => $ length ,
2722
- 'Content-Range ' => $ offsetResponse ,
2723
- ]);
2720
+ $ response ->expects ($ this ->at (2 ))
2721
+ ->method ('header ' )
2722
+ ->with ([
2723
+ 'Content-Length ' => $ length ,
2724
+ 'Content-Range ' => $ offsetResponse ,
2725
+ ]);
2724
2726
2725
- $ response ->expects ($ this ->any ())
2726
- ->method ('_isActive ' )
2727
- ->will ($ this ->returnValue (true ));
2727
+ $ response ->expects ($ this ->any ())
2728
+ ->method ('_isActive ' )
2729
+ ->will ($ this ->returnValue (true ));
2728
2730
2729
- $ response ->file (
2730
- TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2731
- ['download ' => false ]
2732
- );
2731
+ $ response ->file (
2732
+ TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2733
+ ['download ' => false ]
2734
+ );
2733
2735
2734
- ob_start ();
2735
- $ result = $ response ->send ();
2736
- ob_get_clean ();
2736
+ ob_start ();
2737
+ $ result = $ response ->send ();
2738
+ ob_get_clean ();
2739
+ });
2737
2740
}
2738
2741
2739
2742
/**
2740
2743
* testFileRangeNoDownload method
2741
2744
*
2745
+ * @group deprecated
2742
2746
* @return void
2743
2747
*/
2744
2748
public function testFileRangeNoDownload ()
2745
2749
{
2746
- $ _SERVER ['HTTP_RANGE ' ] = 'bytes=8-25 ' ;
2747
- $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2748
- ->setMethods ([
2749
- 'header ' ,
2750
- 'type ' ,
2751
- '_sendHeader ' ,
2752
- '_isActive ' ,
2753
- ])
2754
- ->getMock ();
2750
+ $ this ->deprecated (function () {
2751
+ $ _SERVER ['HTTP_RANGE ' ] = 'bytes=8-25 ' ;
2752
+ $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2753
+ ->setMethods ([
2754
+ 'header ' ,
2755
+ 'type ' ,
2756
+ '_sendHeader ' ,
2757
+ '_isActive ' ,
2758
+ ])
2759
+ ->getMock ();
2755
2760
2756
- $ response ->expects ($ this ->exactly (1 ))
2757
- ->method ('type ' )
2758
- ->with ('css ' )
2759
- ->will ($ this ->returnArgument (0 ));
2761
+ $ response ->expects ($ this ->exactly (1 ))
2762
+ ->method ('type ' )
2763
+ ->with ('css ' )
2764
+ ->will ($ this ->returnArgument (0 ));
2760
2765
2761
- $ response ->expects ($ this ->at (1 ))
2762
- ->method ('header ' )
2763
- ->with ('Accept-Ranges ' , 'bytes ' );
2766
+ $ response ->expects ($ this ->at (1 ))
2767
+ ->method ('header ' )
2768
+ ->with ('Accept-Ranges ' , 'bytes ' );
2764
2769
2765
- $ response ->expects ($ this ->at (2 ))
2766
- ->method ('header ' )
2767
- ->with ([
2768
- 'Content-Length ' => 18 ,
2769
- 'Content-Range ' => 'bytes 8-25/38 ' ,
2770
- ]);
2771
-
2772
- $ response ->expects ($ this ->any ())
2773
- ->method ('_isActive ' )
2774
- ->will ($ this ->returnValue (true ));
2770
+ $ response ->expects ($ this ->at (2 ))
2771
+ ->method ('header ' )
2772
+ ->with ([
2773
+ 'Content-Length ' => 18 ,
2774
+ 'Content-Range ' => 'bytes 8-25/38 ' ,
2775
+ ]);
2775
2776
2776
- $ response ->file (
2777
- TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2778
- ['download ' => false ]
2779
- );
2777
+ $ response ->expects ($ this ->any ())
2778
+ ->method ('_isActive ' )
2779
+ ->will ($ this ->returnValue (true ));
2780
2780
2781
- ob_start ();
2782
- $ result = $ response ->send ();
2783
- $ output = ob_get_clean ();
2784
- $ this ->assertEquals (206 , $ response ->statusCode ());
2785
- $ this ->assertEquals ('is the test asset ' , $ output );
2786
- $ this ->assertNotSame (false , $ result );
2781
+ $ response ->file (
2782
+ TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2783
+ ['download ' => false ]
2784
+ );
2785
+
2786
+ ob_start ();
2787
+ $ result = $ response ->send ();
2788
+ $ output = ob_get_clean ();
2789
+ $ this ->assertEquals (206 , $ response ->statusCode ());
2790
+ $ this ->assertEquals ('is the test asset ' , $ output );
2791
+ $ this ->assertNotSame (false , $ result );
2792
+ });
2787
2793
}
2788
2794
2789
2795
/**
2790
2796
* testFileRangeInvalidNoDownload method
2791
2797
*
2798
+ * @group deprecated
2792
2799
* @return void
2793
2800
*/
2794
2801
public function testFileRangeInvalidNoDownload ()
2795
2802
{
2796
- $ _SERVER ['HTTP_RANGE ' ] = 'bytes=30-2 ' ;
2797
- $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2798
- ->setMethods ([
2799
- 'header ' ,
2800
- 'type ' ,
2801
- '_sendHeader ' ,
2802
- '_isActive ' ,
2803
- ])
2804
- ->getMock ();
2805
-
2806
- $ response ->expects ($ this ->at (1 ))
2807
- ->method ('header ' )
2808
- ->with ('Accept-Ranges ' , 'bytes ' );
2809
-
2810
- $ response ->expects ($ this ->at (2 ))
2811
- ->method ('header ' )
2812
- ->with ([
2813
- 'Content-Range ' => 'bytes 0-37/38 ' ,
2814
- ]);
2803
+ $ this ->deprecated (function () {
2804
+ $ _SERVER ['HTTP_RANGE ' ] = 'bytes=30-2 ' ;
2805
+ $ response = $ this ->getMockBuilder ('Cake\Http\Response ' )
2806
+ ->setMethods ([
2807
+ '_sendHeader ' ,
2808
+ ])
2809
+ ->getMock ();
2815
2810
2816
- $ response ->file (
2817
- TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2818
- ['download ' => false ]
2819
- );
2811
+ $ response ->file (
2812
+ TEST_APP . 'vendor ' . DS . 'css ' . DS . 'test_asset.css ' ,
2813
+ ['download ' => false ]
2814
+ );
2820
2815
2821
- $ this ->assertEquals (416 , $ response ->statusCode ());
2822
- $ result = $ response ->send ();
2816
+ $ this ->assertEquals (416 , $ response ->statusCode ());
2817
+ $ this ->assertEquals ('bytes ' , $ response ->getHeaderLine ('Accept-Ranges ' ));
2818
+ $ this ->assertEquals ('text/css ' , $ response ->getType ());
2819
+ $ this ->assertEquals ('bytes 0-37/38 ' , $ response ->getHeaderLine ('Content-Range ' ));
2820
+ $ result = $ response ->send ();
2821
+ });
2823
2822
}
2824
2823
2825
2824
/**
2826
2825
* Test the location method.
2827
2826
*
2827
+ * @group deprecated
2828
2828
* @return void
2829
2829
*/
2830
2830
public function testLocation ()
2831
2831
{
2832
- $ response = new Response ();
2833
- $ this ->assertNull ($ response ->location (), 'No header should be set. ' );
2834
- $ this ->assertNull ($ response ->location ('http://example.org ' ), 'Setting a location should return null ' );
2835
- $ this ->assertEquals ('http://example.org ' , $ response ->location (), 'Reading a location should return the value. ' );
2832
+ $ this ->deprecated (function () {
2833
+ $ response = new Response ();
2834
+ $ this ->assertNull ($ response ->location (), 'No header should be set. ' );
2835
+ $ this ->assertNull ($ response ->location ('http://example.org ' ), 'Setting a location should return null ' );
2836
+ $ this ->assertEquals ('http://example.org ' , $ response ->location (), 'Reading a location should return the value. ' );
2837
+ });
2836
2838
}
2837
2839
2838
2840
/**
0 commit comments