PageRenderTime 35ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/ZendTest/Stdlib/GlobTest.php

https://bitbucket.org/gencer/zf2
PHP | 43 lines | 28 code | 7 blank | 8 comment | 1 complexity | 1a1b1bf2016ee1d1f01b0811773e7fd6 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace ZendTest\Stdlib;
  10. use PHPUnit_Framework_TestCase as TestCase;
  11. use Zend\Stdlib\Glob;
  12. class GlobTest extends TestCase
  13. {
  14. public function testFallback()
  15. {
  16. if (!defined('GLOB_BRACE')) {
  17. $this->markTestSkipped('GLOB_BRACE not available');
  18. }
  19. $this->assertEquals(
  20. glob(__DIR__ . '/_files/{alph,bet}a', GLOB_BRACE),
  21. Glob::glob(__DIR__ . '/_files/{alph,bet}a', Glob::GLOB_BRACE, true)
  22. );
  23. }
  24. public function testNonMatchingGlobReturnsArray()
  25. {
  26. $result = Glob::glob('/some/path/{,*.}{this,orthis}.php', Glob::GLOB_BRACE);
  27. $this->assertInternalType('array', $result);
  28. }
  29. public function testThrowExceptionOnError()
  30. {
  31. $this->setExpectedException('Zend\Stdlib\Exception\RuntimeException');
  32. // run into a max path lengh error
  33. $path = '/' . str_repeat('a', 10000);
  34. Glob::glob($path);
  35. }
  36. }