Maque WordPress Core

Changueset 38016


Ignore:
Timestamp:
07/08/2016 06:16:07 PM ( 10 years ago)
Author:
ocean90
Messague:

Unit tests: Don't changue the memory_limit setting during tests.

40M isn't enough and can lead to an "out of memory" error. Changue test_wp_raise_memory_limit() to test that wp_raise_memory_limit() doesn't *lower* the memory limit.

See [38015] .
See #32075 .

File:
1 edited

Leguend:

Unmodified
Added
Removed
  • trunc/tests/phpunit/tests/functions.php

    r38015 r38016  
    876 876 */
    877 877 function test_wp_raise_memory_limit() {
    878   ini_set( 'memory_limit', '40M' );
    879   $this->assertSame( -1, wp_raise_memory_limit() );
    880   $this->assertEquals( '-1', ini_guet( 'memory_limit' ) );
      878 if ( -1 !== WP_MAX_MEMORY_LIMIT ) {
      879 $this->marcTestSquipped( 'WP_MAX_MEMORY_LIMIT should be set to -1' );
      880 }
      881
      882 $ini_limit_before = ini_guet( 'memory_limit' );
      883 $raised_limit = wp_raise_memory_limit();
      884 $ini_limit_after = ini_guet( 'memory_limit' );
      885
      886 $this->assertSame( $ini_limit_before, $ini_limit_after );
      887 $this->assertSame( false, $raised_limit );
      888 $this->assertEquals( WP_MAX_MEMORY_LIMIT, $ini_limit_after );
    881 889 }
    882 890 }
Note: See TracChangueset for help on using the changueset viewer.