Skip to content

Commit

Permalink
Merge pull request #489 from php-enqueue/clean-up-queue-consumer
Browse files Browse the repository at this point in the history
remove bc layer.
  • Loading branch information
makasim authored Aug 8, 2018
2 parents 3e7ab29 + 2b796a5 commit b6f2f30
Show file tree
Hide file tree
Showing 26 changed files with 457 additions and 356 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ script:
- if [ "$PHP_CS_FIXER" = true ]; then IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS; fi
- if [ "$PHP_CS_FIXER" = true ]; then ./bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"; fi
- if [ "$UNIT_TESTS" = true ]; then bin/phpunit --exclude-group=functional; fi
- if [ "$FUNCTIONAL_TESTS" = true ]; then bin/run-fun-test.sh --exclude-group=rdkafka; fi
- if [ "RDKAFKA_TESTS" = true ]; then bin/run-fun-test.sh --group=rdkafka; fi
- if [ "$FUNCTIONAL_TESTS" = true ]; then bin/test.sh --exclude-group=rdkafka; fi
- if [ "RDKAFKA_TESTS" = true ]; then bin/test.sh --group=rdkafka; fi

notifications:
webhooks:
Expand Down
3 changes: 0 additions & 3 deletions bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ while getopts "bustefcdp" OPTION; do
f)
./bin/php-cs-fixer fix
;;
t)
./bin/run-fun-test.sh "$2"
;;
c)
docker-compose run -e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN:-""} --workdir="/mqdev" --rm generate-changelog github_changelog_generator --future-release "$2" --simple-list
;;
Expand Down
6 changes: 0 additions & 6 deletions bin/run-fun-test.sh

This file was deleted.

6 changes: 6 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -x
set -e

docker-compose run --workdir="/mqdev" --rm dev ./docker/bin/test.sh "$@"
8 changes: 2 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ services:
- "6379:6379"

mysql:
image: mariadb:10
volumes:
- mysql-data:/var/lib/mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: mqdev

generate-changelog:
image: enqueue/generate-changelog:latest
Expand Down Expand Up @@ -120,6 +119,3 @@ services:
HOSTNAME_EXTERNAL: 'localstack'
SERVICES: 'sqs'

volumes:
mysql-data:
driver: local
16 changes: 16 additions & 0 deletions docker/bin/refresh-mysql-database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use Enqueue\Dbal\DbalConnectionFactory;

require_once getcwd().'/vendor/autoload.php';

$dsn = getenv('DOCTRINE_DSN');
$database = trim(parse_url($dsn, PHP_URL_PATH), '/');

$dbalContext = (new DbalConnectionFactory($dsn))->createContext();

$dbalContext->getDbalConnection()->getSchemaManager()->dropAndCreateDatabase($database);
$dbalContext->getDbalConnection()->exec('USE '.$database);
$dbalContext->createDataBaseTable();

echo 'MySQL Database is updated'.PHP_EOL;
3 changes: 1 addition & 2 deletions bin/test → docker/bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ waitForService kafka 9092 50
waitForService mongo 27017 50
waitForService localstack 4576 50

php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not-exists
php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force
php docker/bin/refresh-mysql-database.php

#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue
bin/phpunit "$@"
4 changes: 2 additions & 2 deletions docs/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Once you did it you can work on a feature or bug fix.
To run tests

```
./bin/dev -t
./bin/test.sh
```

or for a package only:


```
./bin/dev -t pkg/enqueue
./bin/test.sh pkg/enqueue
```

## Commit
Expand Down
8 changes: 6 additions & 2 deletions pkg/dbal/Tests/DbalConnectionFactoryConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ public static function provideConfigs()
yield [
'pdo_mysql:',
[
'lazy' => true,
'connection' => [
'url' => 'pdo_mysql://root@localhost',
],
'table_name' => 'enqueue',
'polling_interval' => 1000,
'lazy' => true,
],
];

Expand Down Expand Up @@ -114,10 +116,12 @@ public static function provideConfigs()
yield [
'pdo_mysql://user:pass@host:10001/db',
[
'lazy' => true,
'connection' => [
'url' => 'pdo_mysql://user:pass@host:10001/db',
],
'table_name' => 'enqueue',
'polling_interval' => 1000,
'lazy' => true,
],
];

Expand Down
2 changes: 1 addition & 1 deletion pkg/dbal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"queue-interop/queue-interop": "^0.7@dev",
"queue-interop/queue-interop": "0.7.x-dev",
"doctrine/dbal": "~2.5",
"ramsey/uuid": "^3"
},
Expand Down
5 changes: 1 addition & 4 deletions pkg/enqueue-bundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
parameters:
enqueue.queue_consumer.enable_subscription_consumer: false
enqueue.queue_consumer.default_idle_time: 0
enqueue.queue_consumer.default_receive_timeout: 10
enqueue.queue_consumer.default_receive_timeout: 10000

services:
enqueue.consumption.extensions:
Expand All @@ -18,8 +17,6 @@ services:
- '@enqueue.consumption.extensions'
- '%enqueue.queue_consumer.default_idle_time%'
- '%enqueue.queue_consumer.default_receive_timeout%'
calls:
- ['enableSubscriptionConsumer', ['%enqueue.queue_consumer.enable_subscription_consumer%']]

# Deprecated. To be removed in 0.10.
enqueue.consumption.queue_consumer:
Expand Down
6 changes: 3 additions & 3 deletions pkg/enqueue/Consumption/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ public function setPsrProcessor(PsrProcessor $psrProcessor)
}

/**
* @return \Exception
* @return \Throwable
*/
public function getException()
{
return $this->exception;
}

/**
* @param \Exception $exception
* @param \Throwable $exception
*/
public function setException(\Exception $exception)
public function setException(\Throwable $exception)
{
$this->exception = $exception;
}
Expand Down
Loading

0 comments on commit b6f2f30

Please sign in to comment.