Skip to content

Commit

Permalink
initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4git committed Jan 16, 2024
1 parent bffbf0a commit 50d3a87
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,yaml,yml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.neon]
indent_style = tab
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/bin/ export-ignore
/compose.yaml export-ignore
/depfile.yaml export-ignore
/docs/ export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Composer
/composer.lock
/vendor/

# PHP-CS-Fixer
/.php-cs-fixer.cache

# PHPUnit
/.phpunit.result.cache
/.phpunit.cache/
/reports/

# IDE project files
/.idea/
39 changes: 39 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* This document has been initially generated with
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.5.0|configurator
* and then adapted to our needs
*/

return (new PhpCsFixer\Config)
->setFinder((new PhpCsFixer\Finder)
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->notPath(['DependencyInjection/Configuration.php', 'app/var'])
)
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,

// declare strict types must be on first line after opening tag
'blank_line_after_opening_tag' => false, // overwrite @Symfony
'linebreak_after_opening_tag' => false, // overwrite @Symfony
'declare_strict_types' => true, // custom

// allow throw's in multiple lines, so message can be a long string
'single_line_throw' => false, // overwrite @Symfony

// we want spaces
'concat_space' => ['spacing' => 'one'], // overwrite @Symfony

// we want to leave the choice to the developer,
// because some people have their own style of naming test methods
'php_unit_method_casing' => false, // overwrite @Symfony

// we want to leave the choice to the developer
'php_unit_test_annotation' => false, // overwrite @Symfony:risky
]);
27 changes: 27 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
database:
image: mariadb:10.11.4
command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci" ]
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: pimcore
MYSQL_PASSWORD: pimcore
MYSQL_USER: pimcore
tmpfs:
- /tmp/
- /var/lib/mysql/
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 5s
timeout: 10s

php:
image: pimcore/pimcore:php8.2-latest
volumes:
- ./:/var/www/html/
- /home/ldschaak/.cache/composer:/.cache/composer
environment:
MYSQL_SERVER_VERSION: mariadb-10.11.4
depends_on:
database:
condition: service_healthy
82 changes: 82 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "teamneusta/elastic-index-bundle",
"type": "symfony-bundle",
"description": "This bundle can be used to index your objects into Elasticsearch server in an object-oriented way.",
"license": "MIT",
"authors": [
{
"name": "team neusta GmbH",
"email": "[email protected]",
"homepage": "https://www.team-neusta.de/",
"role": "Maintainer"
},
{
"name": "Luka Dschaak",
"email": "[email protected]",
"role": "Maintainer"
}
],
"config": {
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"require": {
"php": "^8.0",
"symfony/config": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/property-access": "^5.4 || ^6.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.11",
"jangregor/phpstan-prophecy": "^1.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-symfony": "^1.2",
"phpunit/phpunit": "^9.5",
"qossmic/deptrac-shim": "^0.24 || ^1.0",
"symfony/filesystem": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^5.4 || ^6.2",
"symfony/test-pack": "^1.0",
"symfony/yaml": "^5.4 || ^6.2"
},
"autoload": {
"psr-4": {
"Neusta\\ElasticIndexBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Neusta\\ElasticIndexBundle\\Tests\\": "tests/"
},
"classmap": [
"tests/app/TestKernel.php"
]
},
"scripts": {
"cs:check": "@cs:fix --dry-run",
"cs:check:gitlab-ci": "php-cs-fixer fix --dry-run --ansi --verbose --diff --format=gitlab > php-cs-fixer.json",
"cs:fix": "php-cs-fixer fix --ansi --verbose --diff",
"phpstan": "phpstan analyse --ansi",
"phpstan:gitlab-ci": "phpstan analyse --ansi --no-interaction --no-progress --error-format=gitlab > phpstan-report.json",
"tests": "phpunit",
"tests:coverage:gitlab-ci": "phpunit --colors=never --coverage-text --coverage-cobertura .coverage/cobertura.xml --log-junit .coverage/junit.xml",
"deptrac:analyse": "deptrac --config-file=depfile.yaml",
"deptrac:analyse:visual": "deptrac --formatter=graphviz-html --output=deptrac.analyse-result.html --config-file=depfile.yaml"
},
"scripts-descriptions": {
"cs:check": "Checks code style (but doesn't fix anything)",
"cs:check:gitlab-ci": "Checks code style and redirects the output into a GitLab readable file",
"cs:fix": "Checks and fixes code style",
"phpstan": "Checks for code smells",
"phpstan:gitlab-ci": "Checks for code smells and redirects the output into a GitLab readable file",
"tests": "Run all phpunit tests",
"tests:coverage:gitlab-ci": "Run all phpunit tests and create coverage reports",
"deptrac:analyse": "Analyse your dependencies and follow the pre-defined rules and layers",
"deptrac:analyse:visual": "Visualize your dependencies and follow the pre-defined rules and layers"
}
}
92 changes: 92 additions & 0 deletions depfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
deptrac:
paths:
- ./src
exclude_files:
- '#.*test.*#'
layers:
- name: Converter Bundle
collectors:
- type: bool
must:
- type: classNameRegex
value: '#Neusta\\ConverterBundle.*#'
- name: Elastica Bundle
collectors:
- type: bool
must_not:
- type: className
value: 'Neusta\\ElasticBundle\\.*'
must:
- type: classNameRegex
value: '#Elastica\\.*#'
- name: Elastically Bundle
collectors:
- type: bool
must:
- type: classNameRegex
value: '#JoliCode\\Elastically\\.*#'
- name: Logging Framework
collectors:
- type: bool
must:
- type: classNameRegex
value: '#Psr\\Log\\.*#'
- name: Symfony Framework
collectors:
- type: bool
must:
- type: classNameRegex
value: '#Symfony\\.*#'
- name: Pimcore Framework
collectors:
- type: bool
must_not:
- type: className
value: 'Neusta\\ElasticBundle\\Pimcore\\Index\\.*'
must:
- type: classNameRegex
value: '#Pimcore\\.*#'
- name: Pimcore Index
collectors:
- type: bool
must:
- type: className
value: 'Neusta\\ElasticBundle\\Pimcore\\Index\\.*'
- name: Pimcore Search
collectors:
- type: bool
must:
- type: className
value: 'Neusta\\ElasticBundle\\Pimcore\\Search\\.*'
- name: Index
collectors:
- type: bool
must:
- type: className
value: 'Neusta\\ElasticBundle\\Index\\.*'
- name: Search
collectors:
- type: bool
must:
- type: className
value: 'Neusta\\ElasticBundle\\Search\\.*'
ruleset:
Pimcore Index:
- Index
- Pimcore Framework
- Converter Bundle
- Logging Framework
- Symfony Framework
Pimcore Search:
- Search
Index:
- Converter Bundle
- Elastica Bundle
- Elastically Bundle
- Logging Framework
- Symfony Framework
Search:
- Converter Bundle
- Elastica Bundle
- Elastically Bundle

8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:

level: 8

paths:
- src

checkGenericClassInNonGenericObjectType: false
32 changes: 32 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
cacheResultFile=".phpunit.cache/test-results"
colors="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="display_startup_errors" value="On"/>
<ini name="display_errors" value="On"/>
<ini name="error_reporting" value="-1"/>
<env name="KERNEL_CLASS" value="TestKernel"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
</php>

<testsuites>
<testsuite name="All tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage" processUncoveredFiles="true">
<include>
<directory>./src</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 50d3a87

Please sign in to comment.