Skip to content

Commit

Permalink
Merge a9f0e92 into 52cb50d
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolaszek committed Oct 23, 2020
2 parents 52cb50d + a9f0e92 commit e3afcaf
Show file tree
Hide file tree
Showing 33 changed files with 455 additions and 553 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,66 @@
name: CI Workflow

on: [push, pull_request]

jobs:
code-style:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate

- name: Enable Composer parallel downloads
run: composer global require symfony/flex

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Check code style
run: composer phpcs:check

- name: Track avoidable bugs
run: composer phpstan:analyze

tests:

runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
strategy:
max-parallel: 10
matrix:
php:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
experimental: [ false ]
include:
- php: 8.0
experimental: true

steps:
- uses: actions/checkout@v2

- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop

- uses: mirromutth/mysql-action@v1.1
with:
mysql user: test
mysql password: test
mysql database: test

- name: Enable Composer parallel downloads
run: composer global require symfony/flex

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run tests
run: composer tests:run
6 changes: 5 additions & 1 deletion .gitignore
@@ -1 +1,5 @@
tests/config/settings.yml
tests/config/settings.yml
.php_cs.cache
.phpcs-cache
composer.lock
phpunit.xml
11 changes: 9 additions & 2 deletions README.md
@@ -1,3 +1,4 @@
![CI Workflow](https://github.com/bpolaszek/simple-dbal/workflows/CI%20Workflow/badge.svg)
[![Latest Stable Version](https://poser.pugx.org/bentools/simple-dbal/v/stable)](https://packagist.org/packages/bentools/simple-dbal)
[![License](https://poser.pugx.org/bentools/simple-dbal/license)](https://packagist.org/packages/bentools/simple-dbal)
[![Quality Score](https://img.shields.io/scrutinizer/g/bpolaszek/simple-dbal.svg?style=flat-square)](https://scrutinizer-ci.com/g/bpolaszek/simple-dbal)
Expand Down Expand Up @@ -63,7 +64,7 @@ For _INSERT_ / _UPDATE_ / _DELETE_ queries, use the following methods:
Installation
------------
```
composer require bentools/simple-dbal
composer require bentools/simple-dbal:0.7.*
```

Tests
Expand All @@ -73,7 +74,7 @@ Tests
```

Documentation
-----
-------------

[Getting started](doc/01-GettingStarted.md)

Expand All @@ -84,3 +85,9 @@ Documentation
[Connection pools](doc/04-ConnectionPools.md)

[Known Issues](doc/05-KnownIssues.md)


See also
--------

[bentools/where](https://github.com/bpolaszek/where) - A fluent, immutable SQL expressions builder.
26 changes: 15 additions & 11 deletions composer.json
Expand Up @@ -12,13 +12,14 @@
"guzzlehttp/promises": "^1.3"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "~2.0",
"satooshi/php-coveralls": "^1.0",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^3.2",
"bentools/iterable-functions": "^1.1",
"incenteev/composer-parameter-handler": "^2.1",
"symfony/yaml": "^3.2"
"symfony/yaml": "^3.2",
"phpstan/phpstan": "^0.12.32",
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^7.0",
"friendsofphp/php-cs-fixer": "^2.16"
},
"autoload-dev": {
"psr-4": {
Expand All @@ -34,14 +35,17 @@
}
},
"scripts": {
"set-parameters": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
]
"tests:run": "vendor/bin/phpunit",
"phpcs:check": "vendor/bin/phpcs --standard=PSR12 -n src",
"php-cs-fixer:run": "vendor/bin/php-cs-fixer fix src --allow-risky=yes",
"phpcbf:run": "vendor/bin/phpcbf --standard=PSR12 -n bin migrations src tests || true",
"phpcs:fix": [
"@php-cs-fixer:run",
"@phpcbf:run"
],
"phpstan:analyze": "vendor/bin/phpstan analyze"
},
"extra": {
"incenteev-parameters": {
"file": "tests/config/settings.yml"
},
"branch-alias": {
"dev-master": "1.0.x-dev"
}
Expand Down
15 changes: 15 additions & 0 deletions phpcs.xml.dist
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>

<rule ref="PSR12"/>

<file>src/</file>

</ruleset>
4 changes: 4 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,4 @@
parameters:
level: 5
paths:
- src
8 changes: 8 additions & 0 deletions phpunit.xml.dist
Expand Up @@ -15,6 +15,14 @@
stopOnFailure="false"
verbose="true"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="DATABASE_HOST" value="localhost" force="true" />
<server name="DATABASE_USER" value="test" force="true" />
<server name="DATABASE_PASSWORD" value="test" force="true" />
<server name="DATABASE_NAME" value="test" force="true" />
</php>

<testsuites>
<testsuite name="Full Test Suite">
<directory suffix="Test.php">./tests/src</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Contract/ConnectionInterface.php
Expand Up @@ -27,7 +27,7 @@ public function execute($stmt, array $values = null): ResultInterface;
* Executes a read statement asynchronously.
* The promise MUST return a Result object.
*
* @param $stmt
* @param mixed $stmt
* @param array|null $values
* @return PromiseInterface
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Contract/ReconnectableAdapterInterface.php
Expand Up @@ -4,10 +4,10 @@

interface ReconnectableAdapterInterface
{
const OPT_MAX_RECONNECT_ATTEMPTS = 'max_reconnect_attempts';
const OPT_USLEEP_AFTER_FIRST_ATTEMPT = 'usleep_after_first_attempt';
const DEFAULT_USLEEP_AFTER_FIRST_ATTEMPT = 50000;
const DEFAULT_MAX_RECONNECT_ATTEMPTS = 0;
public const OPT_MAX_RECONNECT_ATTEMPTS = 'max_reconnect_attempts';
public const OPT_USLEEP_AFTER_FIRST_ATTEMPT = 'usleep_after_first_attempt';
public const DEFAULT_USLEEP_AFTER_FIRST_ATTEMPT = 50000;
public const DEFAULT_MAX_RECONNECT_ATTEMPTS = 0;

/**
* @return bool
Expand Down
8 changes: 2 additions & 6 deletions src/Contract/ResultInterface.php
Expand Up @@ -37,6 +37,7 @@ public function asValue();

/**
* Return the ID of the last inserted row or sequence value.
*
* @return mixed|null
*/
public function getLastInsertId();
Expand All @@ -46,10 +47,5 @@ public function getLastInsertId();
*
* @return int
*/
public function count();

/**
* @return ResultInterface
*/
public function withoutStorage(): ResultInterface;
public function count(): int;
}

0 comments on commit e3afcaf

Please sign in to comment.