Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup bundle #1

Merged
merged 7 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org

root = true

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

[{docker-compose.yml,docker-compose.override.yml}]
indent_size = 2

# markdown uses two trailing spaces for explicit line breaks
[*.md]
trim_trailing_whitespace = false
89 changes: 89 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Test application

on:
pull_request:
push:
branches:
- '[0-9]+.x'
- '[0-9]+.[0-9]+'

jobs:
test:
name: 'PHP ${{ matrix.php-version }} (${{ matrix.dependency-versions }})'
runs-on: ubuntu-latest

env:
APP_ENV: test
DATABASE_URL: mysql://root:[email protected]:3306/su_content_test?serverVersion=5.7.32
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

strategy:
fail-fast: false
matrix:
include:
- php-version: '8.1'
dependency-versions: 'lowest'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.2'
dependency-versions: 'highest'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
alexander-schranz marked this conversation as resolved.
Show resolved Hide resolved

- php-version: '8.3'
dependency-versions: 'highest'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype, iconv, mysql
tools: 'composer:v2'

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
composer-options: ${{ matrix.composer-options }}

- name: Execute test cases
run: composer test

lint:
name: "PHP Lint"
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: ctype, iconv, mysql

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest

- name: Lint Code
run: composer lint
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# composer
/composer.phar
composer.lock
/vendor

.php-cs-fixer.cache
.eslintcache
.env.local

# phpunit
.phpunit
phpunit.xml
.phpunit.result.cache

# IDEs
/.idea
*.iml
*~
.web-server-pid

# System files
.DS_Store

# Styleguide
/styleguide

# IDEs
.idea
*.iml

# Jackrabbit
jackrabbit-standalone*
jackrabbit/*

# Symfony CLI
# https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/php.ini
/.php-version

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

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

###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

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

$header = <<<EOF
This file is part of Sulu.

(c) Sulu GmbH

This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude(['var/cache', 'tests/Resources/cache', 'node_modules'])
->in(__DIR__);

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'class_definition' => false,
'concat_space' => ['spacing' => 'one'],
'function_declaration' => ['closure_function_spacing' => 'none'],
'header_comment' => ['header' => $header],
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@internal']],
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
'ordered_imports' => true,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_types_order' => false,
'single_line_throw' => false,
'single_line_comment_spacing' => false,
'phpdoc_to_comment' => [
'ignored_tags' => ['todo', 'var'],
],
'phpdoc_separation' => [
'groups' => [
['Serializer\\*', 'VirtualProperty', 'Accessor', 'Type', 'Groups', 'Expose', 'Exclude', 'SerializedName', 'Inline', 'ExclusionPolicy'],
],
],
'get_class_to_class_keyword' => false, // should be enabled as soon as support for php < 8 is dropped
'nullable_type_declaration_for_default_null_value' => true,
'no_null_property_initialization' => false,
'fully_qualified_strict_types' => false,
])
->setFinder($finder);

return $config;
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ We are committed to a fully transparent development process and **highly appreci

In case you have questions, we are happy to welcome you in our official [Slack channel](https://sulu.io/services-and-support).
If you found a bug or miss a specific feature, feel free to **file a new issue** with a respective title and description
on the the [sulu/SuluHeadlessBundle](https://github.com/sulu/SuluHeadlessBundle) repository.
on the [sulu/SuluPHPCRMigrationBundle](https://github.com/sulu/SuluPHPCRMigrationBundle) repository.


## 📘&nbsp; License
Expand Down
14 changes: 14 additions & 0 deletions Resources/config/command.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Command -->
<service id="sulu_phpcr_migration.migrate_command"
class="Sulu\Bundle\PhpcrMigrationBundle\UserInterface\Command\MigratePhpcrCommand">
<argument type="service" id="sulu_phpcr_migration.session_manager"/>

<tag name="console.command"/>
</service>
</services>
</container>
14 changes: 14 additions & 0 deletions Resources/config/session.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Command -->
<service id="sulu_phpcr_migration.session_manager"
class="Sulu\Bundle\PhpcrMigrationBundle\Application\Session\SessionManager">
<argument>%sulu_phpcr_migration.configuration%</argument>
<argument type="service" id="sulu_phpcr_migration.connection" on-invalid="null"/>

</service>
</services>
</container>
1 change: 1 addition & 0 deletions Tests/Application/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ENV=test
39 changes: 39 additions & 0 deletions Tests/Application/config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

/*
* This file is part of Sulu.
*
* (c) Sulu GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

use Symfony\Component\Dotenv\Dotenv;

$file = __DIR__ . '/../../../vendor/autoload.php';

if (!\file_exists($file)) {
throw new RuntimeException('Install dependencies to run test suite.');
}

require $file;

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (\is_array($env = @include \dirname(__DIR__) . '/.env.local.php')) {
$_SERVER += $env;
$_ENV += $env;
} elseif (!\class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
$path = \dirname(__DIR__) . '/.env';
$dotenv = new Dotenv();
$dotenv->loadEnv($path);
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || \filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
Empty file added Tests/Functional/.gitkeep
Empty file.
Empty file added Tests/Unit/.gitkeep
Empty file.
16 changes: 16 additions & 0 deletions Tests/test-bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

/*
* This file is part of Sulu.
*
* (c) Sulu GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

\date_default_timezone_set('UTC');

require __DIR__ . '/Application/config/bootstrap.php';
Loading
Loading