Skip to content

Commit

Permalink
Fix travis for PHP7 and dist trusty for HHHVM. (#74)
Browse files Browse the repository at this point in the history
* Fix travis for PHP7 and dist trusty for HHHVM.

* Cache composer.

* Fix error "Only variables should be passed by reference"

* Fix PHPUnit reports

* Add codecov.
  • Loading branch information
petrabarus authored Aug 30, 2017
1 parent 6b25b34 commit 14a258b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
21 changes: 15 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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;"
Expand All @@ -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)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions tests/Queues/MultipleQueueTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

class MultipleQueueTest extends PHPUnit_Framework_TestCase {

public function test() {
$queue = Yii::createObject([
'class' => '\UrbanIndo\Yii2\Queue\Queues\MultipleQueue',
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 14a258b

Please sign in to comment.