diff --git a/.gitignore b/.gitignore index 5cc78c4b..f1a8d7d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ phpunit.xml vendor/ - +composer.lock diff --git a/.travis.yml b/.travis.yml index b6834b7f..65ac9497 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,33 @@ language: php +sudo: false + +cache: + directories: + - "$HOME/.composer/cache" + php: - - 5.5 - - 5.6 + - 5.5 + - 5.6 + - 7.0 + - hhvm + - 7 -before_script: - - curl -s http://getcomposer.org/installer | php - - php composer.phar install --dev +matrix: + include: + - php: 5.6 + env: SYMFONY_VERSION="2.3.*" + - php: 5.6 + env: SYMFONY_VERSION="2.7.*" + - php: 5.6 + env: SYMFONY_VERSION="2.8.*" + - php: 5.6 + env: SYMFONY_VERSION="3.0.*" -script: phpunit --coverage-clover clover +before_install: if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi -after_success: - - curl -sL https://bit.ly/artifact-uploader | php +install: composer update + +script: phpunit --coverage-clover clover +after_success: curl -sL https://bit.ly/artifact-uploader | php diff --git a/Command/RunCommand.php b/Command/RunCommand.php index f0b1d18a..f89b1a89 100644 --- a/Command/RunCommand.php +++ b/Command/RunCommand.php @@ -429,7 +429,7 @@ private function getCommandProcessBuilder() } $pb - ->add('php') + ->add($this->getContainer()->getParameter('jms_job_queue.php_binary')) ->add($this->getContainer()->getParameter('kernel.root_dir').'/console') ->add('--env='.$this->env) ; diff --git a/Console/Application.php b/Console/Application.php index 4a56561a..6ef011d5 100644 --- a/Console/Application.php +++ b/Console/Application.php @@ -11,7 +11,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\HttpKernel\Exception\FlattenException; +use Symfony\Component\Debug\Exception\FlattenException; +use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException; use Symfony\Component\HttpKernel\KernelInterface; /** @@ -89,7 +90,7 @@ private function saveDebugInformation(\Exception $ex = null) 'id' => $jobId, 'memoryUsage' => memory_get_peak_usage(), 'memoryUsageReal' => memory_get_peak_usage(true), - 'trace' => serialize($ex ? FlattenException::create($ex) : null), + 'trace' => serialize($ex ? (class_exists(FlattenException::class) ? FlattenException::create($ex) : LegacyFlattenException::create($ex)) : null), ), array( 'id' => \PDO::PARAM_INT, diff --git a/Controller/JobController.php b/Controller/JobController.php index 380672b5..bb647a6c 100644 --- a/Controller/JobController.php +++ b/Controller/JobController.php @@ -28,7 +28,7 @@ class JobController private $statisticsEnabled; /** - * @Route("/", name = "jms_jobs_overview") + * @Route("/overview", name = "jms_jobs_overview") * @Template("JMSJobQueueBundle:Job:overview.html.twig") */ public function overviewAction() diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 11f423a8..21bed901 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -39,7 +39,8 @@ public function getConfigTreeBuilder() $rootNode ->children() - ->booleanNode('statistics')->defaultTrue()->end(); + ->booleanNode('statistics')->defaultTrue()->end() + ->scalarNode('php_binary')->defaultValue('php')->end(); $defaultOptionsNode = $rootNode ->children() diff --git a/DependencyInjection/JMSJobQueueExtension.php b/DependencyInjection/JMSJobQueueExtension.php index 62545669..7c9d5e07 100644 --- a/DependencyInjection/JMSJobQueueExtension.php +++ b/DependencyInjection/JMSJobQueueExtension.php @@ -46,6 +46,7 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('statistics.xml'); } + $container->setParameter('jms_job_queue.php_binary', $config['php_binary']); $container->setParameter('jms_job_queue.queue_options_defaults', $config['queue_options_defaults']); $container->setParameter('jms_job_queue.queue_options', $config['queue_options']); } diff --git a/Entity/Job.php b/Entity/Job.php index de8e42ad..f5954ee4 100644 --- a/Entity/Job.php +++ b/Entity/Job.php @@ -22,7 +22,8 @@ use Doctrine\ORM\Mapping as ORM; use JMS\JobQueueBundle\Exception\InvalidStateTransitionException; use JMS\JobQueueBundle\Exception\LogicException; -use Symfony\Component\HttpKernel\Exception\FlattenException; +use Symfony\Component\Debug\Exception\FlattenException; +use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException; /** * @ORM\Entity(repositoryClass = "JMS\JobQueueBundle\Entity\Repository\JobRepository") @@ -569,8 +570,11 @@ public function getCheckedAt() return $this->checkedAt; } - public function setStackTrace(FlattenException $ex) + public function setStackTrace($ex) { + if(!$ex instanceof FlattenException && !$ex instanceof LegacyFlattenException) { + throw new \InvalidArgumentException(sprintf('Parameter of %s must be an instance of %s or %s.', __METHOD__, FlattenException::class, LegacyFlattenException::class)); + } $this->stackTrace = $ex; } diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php deleted file mode 100644 index b7debbb5..00000000 --- a/Tests/bootstrap.php +++ /dev/null @@ -1,12 +0,0 @@ -