[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/core/ -> templateLoader.php (source)

   1  <?php
   2  
   3  /**
   4   * @group core
   5   * @group core-template-loader
   6   */
   7  class BP_Tests_Template_Loader_Functions extends BP_UnitTestCase {
   8  
   9  	public function setUp() {
  10          if ( version_compare( bp_get_major_wp_version(), '5.5', '<' ) ) {
  11              $this->markTestSkipped(
  12                  'Passing variables in template parts was introduced in WordPress 5.5'
  13              );
  14          }
  15  
  16          add_filter( 'bp_get_template_stack', array( $this, 'template_stack'), 10, 1 );
  17  
  18          parent::setUp();
  19      }
  20  
  21  	public function tearDown() {
  22          remove_filter( 'bp_get_template_stack', array( $this, 'template_stack'), 10, 1 );
  23  
  24          parent::tearDown();
  25      }
  26  
  27  	public function template_stack( $stack = array() ) {
  28          return array_merge(
  29              array(
  30                  dirname( dirname( dirname( __FILE__ ) ) ) . '/assets/templates/',
  31              )
  32          );
  33      }
  34  
  35      /**
  36       * @group bp_buffer_template_part
  37       */
  38  	public function test_bp_buffer_template_part() {
  39          $buffer = bp_buffer_template_part( 'index', null, false, array( 'test' => 1 ) );
  40          $this->assertTrue( 2 === (int) $buffer );
  41      }
  42  }


Generated: Sat Apr 20 01:00:58 2024 Cross-referenced by PHPXref 0.7.1