Skip to content

Commit

Permalink
Merge pull request #3 from Kumatetsu/feature/129854
Browse files Browse the repository at this point in the history
[FEATURE#129854] Doctrine provider SF4
  • Loading branch information
Guillaume DUBOST authored Mar 28, 2019
2 parents 712c5ab + 2e653ff commit ee0e094
Show file tree
Hide file tree
Showing 45 changed files with 1,709 additions and 275 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage_clover: tmp/behat/coverage.clover.xml
json_path: tmp/behat/coveralls-upload.json
28 changes: 28 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
image: etna/drone-php7:php71
cache:
- /root/.composer
env:
- APPLICATION_ENV=test
- COVERALLS_REPO_TOKEN=$$COVERALLS_TOKEN
- COVERALLS_SERVICE_NAME=drone.io
- MYSQL_USER=root
- MYSQL_PASS=
- MYSQL_BASE=test_doctrine_provider
- MYSQL_HOST=127.0.0.1
script:
- nb=1 ; while [ $nb -lt 20 ] && ! echo "show databases;" | mysql -NrB -u "$MYSQL_USER" -h "$MYSQL_HOST" --password="$MYSQL_PASS" ; do echo "Try n $nb mysql not ready"; nb=$(($nb + 1)); sleep 1; done
- echo "CREATE DATABASE IF NOT EXISTS $MYSQL_BASE" | mysql -NrB -u "$MYSQL_USER" -h "$MYSQL_HOST" --password="$MYSQL_PASS"
- composer global require phpdocumentor/phpdocumentor --no-interaction --prefer-dist --no-progress
- composer install --dev --no-interaction --prefer-dist --no-progress --no-scripts
- composer phing
- composer coveralls
services:
- bluetna/drone-mariadb
notify:
slack:
webhook_url: $$SLACK_WEBHOOK_URL
username: drone
channel: $$SLACK_CHANNEL
on_started: true
on_failure: true
on_success: true
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,28 @@ vendor/
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
vendor/
###< symfony/framework-bundle ###

###> behat/symfony2-extension ###
###< behat/symfony2-extension ###

###> phpunit/phpunit ###
/phpunit.xml
###< phpunit/phpunit ###

translations/
tests/
doc/

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###
55 changes: 55 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . "/src")
;

return PhpCsFixer\Config::create()
->setRules([
"@PSR1" => true,
"@PSR2" => true,
"@Symfony" => true,
"@Symfony:risky" => true,
"@DoctrineAnnotation" => true,
"@PHP56Migration" => true,
"@PHP56Migration:risky" => true,
"@PHP70Migration" => true,
"@PHP70Migration:risky" => true,
"@PHP71Migration" => true,
"@PHP71Migration:risky" => true,
"binary_operator_spaces" => [
"align_double_arrow" => true,
"align_equals" => true
],
"concat_space" => true,
"strict_comparison" => true,
"combine_consecutive_issets" => true,
"combine_consecutive_unsets" => true,
"comment_to_phpdoc" => true,
"compact_nullable_typehint" => true,
"explicit_indirect_variable" => true,
"explicit_string_variable" => true,
"header_comment" => [
"commentType" => "PHPDoc",
"header" => "PHP version 7.1\n@author BLU <[email protected]>",
"location" => "after_open",
"separate" => "bottom"
],
"linebreak_after_opening_tag" => true,
"no_useless_else" => true,
"no_useless_return" => true,
"ordered_imports" => true,
"phpdoc_order" => true,
"psr0" => true,
"return_assignment" => true,
"visibility_required" => [
"elements" => ['property', 'method']
],
"concat_space" => [
"spacing" => "one"
]
])
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(false)
;
155 changes: 155 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
tools:
php_sim: true
php_pdepend: true
php_analyzer: true
external_code_coverage:
timeout: 2000
filter:
paths:
- src/
dependency_paths:
- vendor/
checks:
php:
code_rating: true
duplication: true
no_eval: true
security_vulnerabilities: true
sql_injection_vulnerabilities: true
return_doc_comments: true
return_doc_comment_if_not_inferrable: true
parameter_doc_comments: true
param_doc_comment_if_not_inferrable: true
more_specific_types_in_doc_comments: true
fix_doc_comments: true
variable_existence: true
useless_calls: true
use_statement_alias_conflict: true
unused_variables: true
unused_properties: true
unused_parameters: true
unused_methods: true
unreachable_code: true
precedence_mistakes: true
precedence_in_conditions: true
parameter_non_unique: true
no_property_on_interface: true
no_non_implemented_abstract_methods: true
deprecated_code_usage: true
closure_use_not_conflicting: true
closure_use_modifiable: true
avoid_useless_overridden_methods: true
avoid_conflicting_incrementers: true
assignment_of_null_return: true
use_self_instead_of_fqcn: true
uppercase_constants: true
verify_access_scope_valid: true
verify_argument_usable_as_reference: true
verify_property_names: true
too_many_arguments: true
switch_fallthrough_commented: true
spacing_of_function_arguments: true
spacing_around_non_conditional_operators: true
spacing_around_conditional_operators: true
space_after_cast: true
single_namespace_per_use: true
simplify_boolean_return: true
side_effects_or_types: true
scope_indentation:
spaces_per_level: '4'
require_scope_for_properties: true
require_scope_for_methods: true
require_php_tag_first: true
require_braces_around_control_structures: true
remove_trailing_whitespace: true
remove_php_closing_tag: true
remove_extra_empty_lines: true
psr2_switch_declaration: true
psr2_control_structure_declaration: true
psr2_class_declaration: true
property_assignments: true
prefer_while_loop_over_for_loop: true
prefer_unix_line_ending: true
prefer_sapi_constant: true
phpunit_assertions: true
php5_style_constructor: true
overriding_private_members: true
optional_parameters_at_the_end: true
one_class_per_file: true
non_commented_empty_catch_block: true
no_unnecessary_if: true
no_unnecessary_function_call_in_for_loop: true
no_unnecessary_final_modifier: true
no_trait_type_hints: true
no_trailing_whitespace: true
no_space_inside_cast_operator: true
no_space_before_semicolon: true
no_space_around_object_operator: true
no_short_variable_names:
minimum: '3'
no_short_open_tag: true
no_short_method_names:
minimum: '4'
no_mixed_inline_html: true
no_goto: true
no_global_keyword: true
no_exit: true
no_error_suppression: true
no_empty_statements: true
no_else_if_statements: true
no_duplicate_arguments: true
no_debug_code: true
no_commented_out_code: true
newline_at_end_of_file: true
naming_conventions:
local_variable: '^[a-z0-9_]+$'
abstract_class_name: ^Abstract|Factory$
utility_class_name: 'Utils?$'
constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$'
property_name: '^[a-z][a-zA-Z0-9]*$'
method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$'
parameter_name: '^[a-z0-9_]+$'
interface_name: '^[A-Z][a-zA-Z0-9]*Interface$'
type_name: '^[A-Z][a-zA-Z0-9]*$'
exception_name: '^[A-Z][a-zA-Z0-9]*Exception$'
isser_method_name: '^(?:is|has|should|may|supports)'
missing_arguments: true
method_calls_on_non_object: true
lowercase_php_keywords: true
lowercase_basic_constants: true
line_length:
max_length: '120'
instanceof_class_exists: true
function_in_camel_caps: true
function_body_start_on_new_line: true
foreach_usable_as_reference: true
foreach_traversable: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
ensure_lower_case_builtin_functions: true
encourage_shallow_comparison: true
encourage_postdec_operator: true
deadlock_detection_in_loops: true
classes_in_camel_caps: true
catch_class_exists: true
blank_line_after_namespace_declaration: true
avoid_usage_of_logical_operators: true
avoid_unnecessary_concatenation: true
avoid_todo_comments: true
avoid_tab_indentation: true
avoid_superglobals: true
avoid_perl_style_comments: true
avoid_multiple_statements_on_same_line: true
avoid_fixme_comments: true
avoid_entity_manager_injection: true
avoid_duplicate_types: true
avoid_aliased_php_functions: true
argument_type_checks: true
align_assignments: true
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# composer-doctrine-service-provider
Doctrine service provider

## Installation

Modifier composer.json :
```
{
// ...
"require": {
"etna/doctrine-service-provider": "~0.1"
},
"repositories": [
{
"type": "composer",
"url": "http://blu-composer.herokuapp.com"
}
]
}
```


## Tests

juste les tests: `composer test`

tout le code: `composer phing`
10 changes: 10 additions & 0 deletions TestApp/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
ETNA\Doctrine\EtnaDoctrineBundle::class => ['all' => true]
];
19 changes: 19 additions & 0 deletions TestApp/config/packages/cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name

# The app cache caches to the filesystem by default.
# Other options include:

# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost

# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu

# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: ~
3 changes: 3 additions & 0 deletions TestApp/config/packages/dev/routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
router:
strict_requirements: true
48 changes: 48 additions & 0 deletions TestApp/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''

doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci

# define a static test url because we are in testing
url: "mysql://root:@127.0.0.1:3306/test_doctrine_provider"
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/TestApp/src/Entity'
prefix: 'TestApp\Entity'
alias: TestApp
dql:
string_functions:
md5: DoctrineExtensions\Query\Mysql\Md5
sh1: DoctrineExtensions\Query\Mysql\Sha1
sh2: DoctrineExtensions\Query\Mysql\Sha2
numeric_functions:
rand: DoctrineExtensions\Query\Mysql\Rand
round: DoctrineExtensions\Query\Mysql\Round
datetime_functions:
date: DoctrineExtensions\Query\Mysql\Date
datediff: DoctrineExtensions\Query\Mysql\DateDiff
dateadd: DoctrineExtensions\Query\Mysql\DateAdd
dateformat: DoctrineExtensions\Query\Mysql\DateFormat
hour: DoctrineExtensions\Query\Mysql\Hour
day: DoctrineExtensions\Query\Mysql\Day
week: DoctrineExtensions\Query\Mysql\Week
month: DoctrineExtensions\Query\Mysql\Month
year: DoctrineExtensions\Query\Mysql\Year
5 changes: 5 additions & 0 deletions TestApp/config/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
Loading

0 comments on commit ee0e094

Please sign in to comment.