Esempio n. 1
0
 /**
  * Tests hooking the template loader to the WordPress template loading filters
  * with a priority.
  *
  * @covers ::ready
  *
  * @dataProvider loader_provider
  */
 public function test_ready_priority(Loader $loader)
 {
     $priority = rand(11, 99);
     \WP_Mock::expectFilterAdded('template_include', array($loader, 'filter'), $priority);
     $loader->ready($priority);
     $this->assertHooksAdded();
 }
Esempio n. 2
0
 /**
  * Asserts that the loader filter does not change the template.
  *
  * @param \Syllables\Template\Loader $loader  Template loader instance.
  * @param string                     $message Assertion message.
  */
 public function assertLoaderFilterDoesNotChangeTemplate($loader, $message = '')
 {
     $this->assertEquals($this->default_template, $loader->filter($this->default_template), $message);
 }
 /**
  * Custom template loader.
  *
  * @param string[] $post_types Post types whose templates should be overriden.
  * @param string   $base_path  Base path for the template files.
  *
  * @codeCoverageIgnore
  */
 public function __construct($base_path, $post_types)
 {
     parent::__construct($base_path);
     $this->post_types = (array) $post_types;
 }
Esempio n. 4
0
 /**
  * Custom template loader.
  *
  * @param string[] $taxonomies Taxonomies whose templates should be overriden.
  * @param string   $base_path  Base path for the template files.
  *
  * @codeCoverageIgnore
  */
 public function __construct($base_path, $taxonomies)
 {
     parent::__construct($base_path);
     $this->taxonomies = (array) $taxonomies;
 }