BambooTwigFileTest.php in Bamboo Twig  8.3        
                          
                  
                        
  
  
  
  
File
  tests/src/Functional/BambooTwigFileTest.php
  
    View source  
  <?php
namespace Drupal\Tests\bamboo_twig\Functional;
class BambooTwigFileTest extends BambooTwigTestBase {
  
  public static $modules = [
    'bamboo_twig',
    'bamboo_twig_file',
    'bamboo_twig_path',
    'bamboo_twig_test',
  ];
  
  public function testExtensionGuesser() {
    $this
      ->drupalGet('/bamboo-twig-file');
    $this
      ->assertElementPresent('.test-files div.ext-guesser-pdf');
    $this
      ->assertElementContains('.test-files div.ext-guesser-pdf', 'pdf');
    $this
      ->assertElementPresent('.test-files div.ext-guesser-word-legacy');
    $this
      ->assertElementContains('.test-files div.ext-guesser-word-legacy', 'doc');
    $this
      ->assertElementPresent('.test-files div.ext-guesser-word');
    $this
      ->assertElementContains('.test-files div.ext-guesser-word', 'docx');
    $this
      ->assertElementPresent('.test-files div.ext-guesser-jpg');
    $this
      ->assertElementContains('.test-files div.ext-guesser-jpg', 'jpeg');
  }
  
  public function testUrlAbsolute() {
    $this
      ->drupalGet('/bamboo-twig-file');
    $this
      ->assertElementPresent('.test-files div.url-module-file-relative');
    $this
      ->assertElementContains('.test-files div.url-module-file-relative', '/bamboo_twig_test/files/antistatique.jpg');
    $this
      ->assertElementPresent('.test-files div.url-module-file-absolute');
    $this
      ->assertElementContains('.test-files div.url-module-file-absolute', 'http://');
    $this
      ->assertElementContains('.test-files div.url-module-file-absolute', '/bamboo_twig_test/files/antistatique.jpg');
  }
}