From 62b20975739c681a85e92516d70bdb8e071ad877 Mon Sep 17 00:00:00 2001 From: indecim Date: Thu, 18 Jun 2020 15:26:01 +0200 Subject: [PATCH] Set up the bundle basics --- .gitattributes | 6 ++ .github/workflows/ci.yml | 84 +++++++++++++++++++ .gitignore | 3 + .php_cs.dist | 23 +++++ composer.json | 32 +++++++ phpunit.xml.dist | 47 +++++++++++ src/DependencyInjection/Configuration.php | 24 ++++++ .../KAGOnlineTeamLdapExtension.php | 28 +++++++ src/KAGOnlineTeamLdapBundle.php | 21 +++++ src/Resources/config/ldap_services.xml | 9 ++ tests/.gitkeep | 0 11 files changed, 277 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .php_cs.dist create mode 100644 composer.json create mode 100644 phpunit.xml.dist create mode 100644 src/DependencyInjection/Configuration.php create mode 100644 src/DependencyInjection/KAGOnlineTeamLdapExtension.php create mode 100644 src/KAGOnlineTeamLdapBundle.php create mode 100644 src/Resources/config/ldap_services.xml create mode 100644 tests/.gitkeep diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ff430f0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/.github export-ignore +/tests export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.php_cs.dist export-ignore +phpunit.xml.dist export-ignore \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..91c433c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: Continuous Integration +on: + push: + branches: + - master + pull_request: + +jobs: + composer-validate: + name: Validate composer.json + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: Validate + run: composer validate --no-check-lock --strict + + php-cs-fixer: + name: Lint Bundle Source + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: Install PHP-CS-Fixer + run: composer global require friendsofphp/php-cs-fixer --prefer-dist --no-progress --no-suggest + + - name: Enforce coding standards + run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config $GITHUB_WORKSPACE/.php_cs.dist --diff --diff-format udiff --dry-run + + tests: + name: Run tests + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-versions: ['7.2', '7.3', '7.4'] + symfony-version: ['5.0.*', '5.1.*'] + + steps: + - name: Set PHP Version + run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }} + + - name: Disable Xdebug + run: sudo rm /etc/php/${{ matrix.php-versions }}/cli/conf.d/20-xdebug.ini + + - name: Get PHP Version + run: | + ver=$(php -v | grep -oP '(?<=PHP )\d.\d') + echo "::set-output name=version::$ver" + id: php-ver + + - name: Using PHP Version from matrix + run: | + echo "Runner is not using PHP Version defined in the php-versions matrix." + php -v + exit 1 + if: steps.php-ver.outputs.version != matrix.php-versions + + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: Install Global Dependencies + run: | + composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master + - name: Install dependencies + run: | + composer config minimum-stability stable + composer install --prefer-dist --no-progress --no-suggest + env: + SYMFONY_REQUIRE: ${{ matrix.symfony-version }} + + - name: Unit Tests + run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit + + - name: Functional Tests + run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional + + - name: Integration Tests + run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..310e616 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.*.cache +composer.lock +vendor/* \ No newline at end of file diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..c7e4166 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,23 @@ +in([__DIR__.'/src', __DIR__.'/tests']) +; + +return PhpCsFixer\Config::create() + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + '@PHPUnit75Migration:risky' => true, + 'array_syntax' => ['syntax' => 'short'], + 'protected_to_private' => false, + 'semicolon_after_instruction' => false, + 'phpdoc_to_comment' => false, + ]) + ->setRiskyAllowed(true) + ->setFinder($finder) +; \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ddd0ff3 --- /dev/null +++ b/composer.json @@ -0,0 +1,32 @@ +{ + "name": "kagonlineteam/ldap-bundle", + "description": "Symfony bundle that adds abstraction on top the default ldap component.", + "type": "symfony-bundle", + "license": "MIT", + "minimum-stability": "stable", + "require": { + "php": "^7.2", + "symfony/config": "^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/ldap": "^5.0" + }, + "require-dev": { + "symfony/framework-bundle": "^5.0", + "symfony/phpunit-bridge": "^5.0" + }, + "conflict": { + "symfony/http-foundation": "<5.0", + "symfony/framework-bundle": "<5.0" + }, + "autoload": { + "psr-4": { + "KAGOnlineTeam\\Bundle\\Ldap\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "KAGOnlineTeam\\Bundle\\Ldap\\Tests\\": "tests/" + } + } +} \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..9c9f192 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + ./tests + + + ./tests/UnitTests + + + ./tests/FunctionalTests + + + ./tests/IntegrationTests + + + + + + ./src/ + + ./src/Resources + ./tests + ./vendor + + + + + + + + \ No newline at end of file diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php new file mode 100644 index 0000000..5f2ccce --- /dev/null +++ b/src/DependencyInjection/Configuration.php @@ -0,0 +1,24 @@ +getRootNode(); + + $rootNode + ->children() + ->end(); + + return $treeBuilder; + } +} diff --git a/src/DependencyInjection/KAGOnlineTeamLdapExtension.php b/src/DependencyInjection/KAGOnlineTeamLdapExtension.php new file mode 100644 index 0000000..73f97a2 --- /dev/null +++ b/src/DependencyInjection/KAGOnlineTeamLdapExtension.php @@ -0,0 +1,28 @@ +load('ldap_services.xml'); + + $configuration = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($configuration, $configs); + } + + public function getAlias() + { + return 'kagonlineteam_ldap'; + } +} diff --git a/src/KAGOnlineTeamLdapBundle.php b/src/KAGOnlineTeamLdapBundle.php new file mode 100644 index 0000000..d1386c2 --- /dev/null +++ b/src/KAGOnlineTeamLdapBundle.php @@ -0,0 +1,21 @@ +extension) { + $this->extension = new KAGOnlineTeamLdapExtension(); + } + + return $this->extension ?: null; + } +} diff --git a/src/Resources/config/ldap_services.xml b/src/Resources/config/ldap_services.xml new file mode 100644 index 0000000..3fc0237 --- /dev/null +++ b/src/Resources/config/ldap_services.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29