Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #37 from acelaya/feature/dev-dependencies
Browse files Browse the repository at this point in the history
Feature/dev dependencies
  • Loading branch information
acelaya committed Feb 8, 2019
2 parents 17fde56 + c673781 commit 361ed7d
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Expand Up @@ -3,8 +3,12 @@
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/composer.lock export-ignore
/docker-compose.yml export-ignore
/docker-compose.override.yml.dist export-ignore
/indocker export-ignore
/infection.json export-ignore
/CHANGELOG.md export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/phpstan.neon export-ignore
/test export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@ composer.lock
vendor
.idea
build
docker-compose.override.yml
.phpunit.result.cache
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -9,13 +9,16 @@ php:
- 7.2
- 7.3

before_install:
- phpenv config-rm xdebug.ini || return 0

install:
- composer self-update
- composer install --no-interaction

script:
- mkdir build
- composer ac:ci
- composer ci

after_success:
- wget https://scrutinizer-ci.com/ocular.phar
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
@@ -1,13 +1,18 @@
## CHANGELOG

## [Unreleased]
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## 2.2.3 - 2019-02-08

#### Added

* [#30](https://github.com/acelaya/doctrine-enum-type/issues/30) Added PHP 7.3 to the build matrix.

#### Changed

* [#36](https://github.com/acelaya/doctrine-enum-type/issues/36) Updated dev dependencies.
* [#31](https://github.com/acelaya/doctrine-enum-type/issues/31) Performance and maintainability slightly improved by enforcing via code sniffer that all global namespace classes, functions and constants are explicitly imported.
* [#32](https://github.com/acelaya/doctrine-enum-type/issues/32) Updated infection to v0.11
* [#34](https://github.com/acelaya/doctrine-enum-type/issues/34) Added dependency on [Shlinkio](https://github.com/shlinkio/php-coding-standard) coding standard.
Expand Down
33 changes: 17 additions & 16 deletions composer.json
Expand Up @@ -19,9 +19,9 @@
"myclabs/php-enum": "^1.4"
},
"require-dev": {
"infection/infection": "^0.11.0",
"phpstan/phpstan": "^0.10.0",
"phpunit/phpunit": "^7.0",
"infection/infection": "^0.12.0",
"phpstan/phpstan": "^0.11.1",
"phpunit/phpunit": "^8.0 || ^7.0",
"shlinkio/php-coding-standard": "1.0.0"
},
"autoload": {
Expand All @@ -38,22 +38,23 @@
"sort-packages": true
},
"scripts": {
"ac:ci": [
"@ac:cs",
"@ac:stan",
"@ac:test:ci",
"@ac:infect"
"ci": [
"@cs",
"@stan",
"@test:ci",
"@infect:ci"
],

"ac:cs": "phpcs --colors",
"ac:cs:fix": "phpcbf",
"ac:stan": "phpstan analyse src/ --level=6",
"cs": "phpcs --colors",
"cs:fix": "phpcbf",
"stan": "phpstan analyse src/ --level=6",

"ac:test": "phpunit --colors=always",
"ac:test:pretty": "phpunit --colors=always --coverage-html=build/html",
"ac:test:ci": "phpdbg -qrr vendor/bin/phpunit --colors=always --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/phpunit.junit.xml",
"test": "phpunit --colors=always",
"test:pretty": "phpunit --colors=always --coverage-html=build/html",
"test:ci": "phpdbg -qrr vendor/bin/phpunit --colors=always --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/phpunit.junit.xml",

"ac:infect": "infection --threads=4 --min-msi=90 --log-verbosity=2 --only-covered --coverage=build",
"ac:infect:show": "infection --threads=4 --min-msi=90 --log-verbosity=2 --only-covered --show-mutations"
"infect": "infection --threads=4 --min-msi=90 --log-verbosity=default --only-covered",
"infect:ci": "infection --threads=4 --min-msi=90 --log-verbosity=default --only-covered --coverage=build",
"infect:show": "infection --threads=4 --min-msi=90 --log-verbosity=default --only-covered --show-mutations"
}
}
8 changes: 8 additions & 0 deletions docker-compose.override.yml.dist
@@ -0,0 +1,8 @@
version: '3'

services:
doctrine_enum_type_php:
user: 1000:1000
volumes:
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
8 changes: 8 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,8 @@
version: '3'

services:
doctrine_enum_type_php:
container_name: doctrine_enum_type_php
image: composer:1.8.3
volumes:
- ./:/app
3 changes: 3 additions & 0 deletions indocker
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker-compose run doctrine_enum_type_php /bin/sh -c "$*"
44 changes: 21 additions & 23 deletions test/Type/PhpEnumTypeTest.php
Expand Up @@ -25,7 +25,7 @@ class PhpEnumTypeTest extends TestCase
/** @var ObjectProphecy */
protected $platform;

public function setUp()
public function setUp(): void
{
$this->platform = $this->prophesize(AbstractPlatform::class);

Expand All @@ -41,7 +41,7 @@ public function setUp()
/**
* @test
*/
public function enumTypesAreProperlyRegistered()
public function enumTypesAreProperlyRegistered(): void
{
$this->assertFalse(Type::hasType(Action::class));
$this->assertFalse(Type::hasType('gender'));
Expand All @@ -58,7 +58,7 @@ public function enumTypesAreProperlyRegistered()
/**
* @test
*/
public function enumTypesAreProperlyCustomizedWhenRegistered()
public function enumTypesAreProperlyCustomizedWhenRegistered(): void
{
$this->assertFalse(Type::hasType(Action::class));
$this->assertFalse(Type::hasType(Gender::class));
Expand All @@ -82,7 +82,7 @@ public function enumTypesAreProperlyCustomizedWhenRegistered()
/**
* @test
*/
public function registerInvalidEnumThrowsException()
public function registerInvalidEnumThrowsException(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(sprintf(
Expand All @@ -96,7 +96,7 @@ public function registerInvalidEnumThrowsException()
/**
* @test
*/
public function getSQLDeclarationReturnsValueFromPlatform()
public function getSQLDeclarationReturnsValueFromPlatform(): void
{
$this->platform->getVarcharTypeDeclarationSQL(Argument::cetera())->willReturn('declaration');

Expand All @@ -112,7 +112,7 @@ public function getSQLDeclarationReturnsValueFromPlatform()
* @param $phpValue
* @param string $expectedValue
*/
public function convertToDatabaseValueParsesEnum(string $typeName, $phpValue, string $expectedValue)
public function convertToDatabaseValueParsesEnum(string $typeName, $phpValue, string $expectedValue): void
{
$type = $this->getType($typeName);

Expand All @@ -121,22 +121,20 @@ public function convertToDatabaseValueParsesEnum(string $typeName, $phpValue, st
$this->assertEquals($expectedValue, $actualValue);
}

public function provideValues(): array
public function provideValues(): iterable
{
return [
[Action::class, Action::CREATE(), Action::CREATE],
[Action::class, Action::READ(), Action::READ],
[Action::class, Action::UPDATE(), Action::UPDATE],
[Action::class, Action::DELETE(), Action::DELETE],
[Gender::class, Gender::FEMALE(), Gender::FEMALE],
[Gender::class, Gender::MALE(), Gender::MALE],
];
yield [Action::class, Action::CREATE(), Action::CREATE];
yield [Action::class, Action::READ(), Action::READ];
yield [Action::class, Action::UPDATE(), Action::UPDATE];
yield [Action::class, Action::DELETE(), Action::DELETE];
yield [Gender::class, Gender::FEMALE(), Gender::FEMALE];
yield [Gender::class, Gender::MALE(), Gender::MALE];
}

/**
* @test
*/
public function convertToDatabaseValueReturnsNullWhenNullIsProvided()
public function convertToDatabaseValueReturnsNullWhenNullIsProvided(): void
{
$type = $this->getType(Action::class);

Expand All @@ -146,7 +144,7 @@ public function convertToDatabaseValueReturnsNullWhenNullIsProvided()
/**
* @test
*/
public function convertToPHPValueWithValidValueReturnsParsedData()
public function convertToPHPValueWithValidValueReturnsParsedData(): void
{
$type = $this->getType(Action::class);

Expand All @@ -163,7 +161,7 @@ public function convertToPHPValueWithValidValueReturnsParsedData()
/**
* @test
*/
public function convertToPHPValueWithNullReturnsNull()
public function convertToPHPValueWithNullReturnsNull(): void
{
$type = $this->getType(Action::class);

Expand All @@ -174,7 +172,7 @@ public function convertToPHPValueWithNullReturnsNull()
/**
* @test
*/
public function convertToPHPValueWithInvalidValueThrowsException()
public function convertToPHPValueWithInvalidValueThrowsException(): void
{
$type = $this->getType(Action::class);

Expand All @@ -190,7 +188,7 @@ public function convertToPHPValueWithInvalidValueThrowsException()
/**
* @test
*/
public function convertToPHPValueWithCastingMethodProperlyCastsIt()
public function convertToPHPValueWithCastingMethodProperlyCastsIt(): void
{
$type = $this->getType(WithCastingMethods::class);

Expand All @@ -208,7 +206,7 @@ public function convertToPHPValueWithCastingMethodProperlyCastsIt()
/**
* @test
*/
public function convertToDatabaseValueWithCastingMethodProperlyCastsIt()
public function convertToDatabaseValueWithCastingMethodProperlyCastsIt(): void
{
$type = $this->getType(WithCastingMethods::class);

Expand All @@ -219,7 +217,7 @@ public function convertToDatabaseValueWithCastingMethodProperlyCastsIt()
/**
* @test
*/
public function usingChildCustomEnumTypeRegisteredValueIsCorrect()
public function usingChildCustomEnumTypeRegisteredValueIsCorrect(): void
{
MyCustomEnumType::registerEnumType(Action::class);
$type = MyCustomEnumType::getType(Action::class);
Expand All @@ -234,7 +232,7 @@ public function usingChildCustomEnumTypeRegisteredValueIsCorrect()
/**
* @test
*/
public function SQLCommentHintIsAlwaysRequired()
public function SQLCommentHintIsAlwaysRequired(): void
{
$type = $this->getType(Gender::class);

Expand Down

0 comments on commit 361ed7d

Please sign in to comment.