@@ -546,11 +546,15 @@ public function testExpectRuntimeException()
546
546
547
547
/**
548
548
* @covers \josegonzalez\Dotenv\Loader::apacheSetenv
549
- * @expectedException Error
550
- * @expectedExceptionMessage Call to undefined function josegonzalez\Dotenv\apache_getenv()
551
549
*/
552
550
public function testToApacheSetenvExceptionUnavailable ()
553
551
{
552
+ if (version_compare (PHP_VERSION , '7.0 ' , '< ' )) {
553
+ $ this ->markTestSkipped ('Unable to mock bare php functions ' );
554
+ }
555
+
556
+ $ this ->expectException (\Error::class);
557
+ $ this ->expectExceptionMessage ('Call to undefined function josegonzalez\Dotenv\apache_getenv() ' );
554
558
$ this ->Loader ->parse ();
555
559
$ this ->Loader ->apacheSetenv (false );
556
560
}
@@ -560,6 +564,10 @@ public function testToApacheSetenvExceptionUnavailable()
560
564
*/
561
565
public function testToApacheSetenv ()
562
566
{
567
+ if (version_compare (PHP_VERSION , '7.0 ' , '< ' )) {
568
+ $ this ->markTestSkipped ('Unable to mock bare php functions ' );
569
+ }
570
+
563
571
$ apacheGetenv = $ this ->getFunctionMock (__NAMESPACE__ , 'apache_getenv ' );
564
572
$ apacheGetenv ->expects ($ this ->any ())->willReturnCallback (
565
573
function ($ key ) {
@@ -591,6 +599,10 @@ function ($key, $value) {
591
599
*/
592
600
public function testToApacheSetenvSkip ()
593
601
{
602
+ if (version_compare (PHP_VERSION , '7.0 ' , '< ' )) {
603
+ $ this ->markTestSkipped ('Unable to mock bare php functions ' );
604
+ }
605
+
594
606
$ apacheGetenv = $ this ->getFunctionMock (__NAMESPACE__ , 'apache_getenv ' );
595
607
$ apacheGetenv ->expects ($ this ->any ())->willReturnCallback (
596
608
function ($ key ) {
@@ -626,6 +638,10 @@ function ($key, $value) {
626
638
*/
627
639
public function testToApacheSetenvException ()
628
640
{
641
+ if (version_compare (PHP_VERSION , '7.0 ' , '< ' )) {
642
+ $ this ->markTestSkipped ('Unable to mock bare php functions ' );
643
+ }
644
+
629
645
$ apacheGetenv = $ this ->getFunctionMock (__NAMESPACE__ , 'apache_getenv ' );
630
646
$ apacheGetenv ->expects ($ this ->any ())->willReturnCallback (
631
647
function ($ key ) {
0 commit comments