Skip to content

Instantly share code, notes, and snippets.

@spolischook
Last active December 2, 2015 23:06
Show Gist options
  • Save spolischook/69cc1622fd7a60ccb7b5 to your computer and use it in GitHub Desktop.
Save spolischook/69cc1622fd7a60ccb7b5 to your computer and use it in GitHub Desktop.
Get files test
<?php
public function testGetFiles()
{
$method = self::getMethod('getFiles');
$command = new ImportLogsCommand();
$files = $method->invokeArgs($command, [realpath(__DIR__.'/../..')]);
$this->assertContains(realpath(__DIR__.'/ImportLogsCommandTest.php'), $files);
$this->assertContains(realpath(__DIR__.'/../../AppBundle.php'), $files);
}
/**
* @param string $name Method name
* @return \ReflectionMethod
*/
protected static function getMethod($name) {
$class = new \ReflectionClass('AppBundle\Command\ImportLogsCommand');
$method = $class->getMethod($name);
$method->setAccessible(true);
return $method;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment