diff --git a/.travis.yml b/.travis.yml index 2c26330..a35f568 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ language: php +dist: trusty php: - 5.5 - 5.6 - hhvm - #- nightly - + - 7 + - 7.1 + services: - mysql - redis-server - -script: ./vendor/bin/phpunit - + +cache: + directories: + - $HOME/.composer/cache/files + +script: + - ./vendor/bin/phpunit --coverage-clover 'reports/clover.xml' + before_script: #MySQL database init - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test;" @@ -19,5 +26,7 @@ before_script: install: - travis_retry composer self-update && composer --version - - travis_retry composer install --prefer-source --no-interaction + - travis_retry composer install --prefer-dist --no-interaction +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 61c3032..b2a72f2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This provides queue component for Yii2. [![Total Downloads](https://poser.pugx.org/urbanindo/yii2-queue/downloads.svg)](https://packagist.org/packages/urbanindo/yii2-queue) [![Latest Unstable Version](https://poser.pugx.org/urbanindo/yii2-queue/v/unstable.svg)](https://packagist.org/packages/urbanindo/yii2-queue) [![Build Status](https://travis-ci.org/urbanindo/yii2-queue.svg)](https://travis-ci.org/urbanindo/yii2-queue) +[![codecov](https://codecov.io/gh/urbanindo/yii2-queue/branch/master/graph/badge.svg)](https://codecov.io/gh/urbanindo/yii2-queue) ## Requirements You need [PCNT extension](http://php.net/manual/en/book.pcntl.php) enabled to run listener diff --git a/tests/Queues/MultipleQueueTest.php b/tests/Queues/MultipleQueueTest.php index 3bfdaca..7f89444 100644 --- a/tests/Queues/MultipleQueueTest.php +++ b/tests/Queues/MultipleQueueTest.php @@ -1,7 +1,7 @@ '\UrbanIndo\Yii2\Queue\Queues\MultipleQueue', @@ -23,7 +23,7 @@ public function test() { 'class' => 'UrbanIndo\Yii2\Queue\Strategies\RandomStrategy', ] ]); - + $this->assertTrue($queue instanceof UrbanIndo\Yii2\Queue\Queues\MultipleQueue); /* @var $queue UrbanIndo\Yii2\Queue\MultipleQueue */ $this->assertCount(4, $queue->queues); @@ -32,12 +32,12 @@ public function test() { } $this->assertTrue($queue->strategy instanceof \UrbanIndo\Yii2\Queue\Strategies\Strategy); $this->assertTrue($queue->strategy instanceof \UrbanIndo\Yii2\Queue\Strategies\RandomStrategy); - + $queue0 = $queue->getQueue(0); $this->assertTrue($queue0 instanceof \UrbanIndo\Yii2\Queue\Queues\MemoryQueue); $queue4 = $queue->getQueue(4); $this->assertNull($queue4); - + $njob = $queue->strategy->fetch(); $this->assertFalse($njob); $i = 0; @@ -56,13 +56,14 @@ public function test() { $this->assertContains($index, range(0, 3)); $fjob1->runCallable(); $this->assertEquals(1, $i); - - $queue->postToQueue(new \UrbanIndo\Yii2\Queue\Job([ + + $job = new \UrbanIndo\Yii2\Queue\Job([ 'route' => function() use (&$i) { $i += 1; } - ]), 3); - + ]); + $queue->postToQueue($job, 3); + do { //this some times will exist $fjob2 = $queue->fetch();