Skip to content
Snippets Groups Projects
Select Git revision
  • ead0498f4a3e9061005b7012513e9b5c458fc26d
  • master default protected
  • feat/woo-template
  • organize-tests
  • feat/add-show-rendered-method
  • devel
  • 2.1.0
  • 2.0.0
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0
12 results

TestDirResolver.php

Blame
  • TestDirResolver.php 823 B
    <?php
    
    
    use WPDesk\View\Resolver\Exception\CanNotResolve;
    
    class TestDirResolver extends \PHPUnit\Framework\TestCase
    {
        const TEMPLATE_NAME = 'some_template.php';
        const TEMPLATE_FILE = 'some_template.php';
        const TEMPLATE_SUBDIR = 'templates';
    
    
        public function testCanFindInDirPath()
        {
            $dir = __DIR__ . '/' . self::TEMPLATE_SUBDIR;
            $resolver           = new \WPDesk\View\Resolver\DirResolver($dir);
    
            $this->assertStringEndsWith(self::TEMPLATE_FILE, $resolver->resolve(self::TEMPLATE_NAME),
                'Template should be found in dir');
        }
    
        public function testThrowExceptionWhenCannotFind()
        {
            $this->expectException(CanNotResolve::class);
    
            $resolver = new \WPDesk\View\Resolver\DirResolver('whatever');
            $resolver->resolve('whatever2');
        }
    }