FinderFacadeTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /*
  3. * This file is part of the Finder Facade package.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace SebastianBergmann\FinderFacade;
  11. class FinderFacadeTest extends \PHPUnit_Framework_TestCase
  12. {
  13. protected $fixtureDir;
  14. protected function setUp()
  15. {
  16. $this->fixtureDir = __DIR__ . DIRECTORY_SEPARATOR . 'fixture' . DIRECTORY_SEPARATOR;
  17. }
  18. /**
  19. * @covers SebastianBergmann\FinderFacade\FinderFacade::__construct
  20. * @covers SebastianBergmann\FinderFacade\FinderFacade::findFiles
  21. */
  22. public function testFilesCanBeFoundBasedOnConstructorArguments()
  23. {
  24. $facade = new FinderFacade(
  25. array($this->fixtureDir, $this->fixtureDir . 'bar.phtml'),
  26. array('bar'),
  27. array('*.php'),
  28. array('*.fail.php')
  29. );
  30. $this->assertEquals(
  31. array(
  32. $this->fixtureDir . 'bar.phtml',
  33. $this->fixtureDir . 'foo' . DIRECTORY_SEPARATOR . 'bar.php'
  34. ),
  35. $facade->findFiles()
  36. );
  37. }
  38. /**
  39. * @covers SebastianBergmann\FinderFacade\FinderFacade::loadConfiguration
  40. */
  41. public function testFilesCanBeFoundBasedOnXmlConfiguration()
  42. {
  43. $facade = new FinderFacade;
  44. $facade->loadConfiguration($this->fixtureDir . 'test.xml');
  45. $this->assertEquals(
  46. array(
  47. $this->fixtureDir . 'bar.phtml',
  48. $this->fixtureDir . 'foo' . DIRECTORY_SEPARATOR . 'bar.php'
  49. ),
  50. $facade->findFiles()
  51. );
  52. }
  53. }