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

Fix test application with exampletestbundle #237

Merged
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ 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
3 changes: 2 additions & 1 deletion .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
runs-on: ubuntu-latest

env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/su_content_test?serverVersion=5.7
APP_ENV: test
DATABASE_URL: mysql://root:root@127.0.0.1:3306/su_content_test?serverVersion=5.7.32
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

Expand Down
5 changes: 4 additions & 1 deletion Content/Infrastructure/Doctrine/MetadataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
use Sulu\Bundle\MediaBundle\Entity\MediaInterface;
use Sulu\Bundle\TagBundle\Tag\TagInterface;

class MetadataLoader implements EventSubscriber
/**
* @internal
*/
final class MetadataLoader implements EventSubscriber
{
public function getSubscribedEvents()
{
Expand Down
1 change: 0 additions & 1 deletion Content/Infrastructure/Sulu/Link/ContentLinkProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public function preload(array $hrefs, $locale, $published = true): array

/**
* @param B $dimensionContent
*
* @param mixed[] $data
*/
protected function getTitle(DimensionContentInterface $dimensionContent, array $data): ?string
Expand Down
4 changes: 2 additions & 2 deletions Tests/Application/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_ENV=test
DATABASE_URL=mysql://root:@127.0.0.1:3306/su_content_test?serverVersion=5.7
APP_ENV=dev
DATABASE_URL=mysql://root:ChangeMe@127.0.0.1:3306/su_content_dev?serverVersion=5.7
DATABASE_CHARSET=utf8mb4
DATABASE_COLLATE=utf8mb4_unicode_ci
1 change: 0 additions & 1 deletion Tests/Application/.env.dev

This file was deleted.

1 change: 1 addition & 0 deletions Tests/Application/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=mysql://root:ChangeMe@127.0.0.1:3306/su_content_test?serverVersion=8.0
3 changes: 3 additions & 0 deletions Tests/Application/assets/admin/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
last 2 versions and not dead
not ie < 12
not ie_mob < 12
15 changes: 15 additions & 0 deletions Tests/Application/assets/admin/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# the package.json in this folder uses a preinstall and postinstall script for symlinking the javascript code of the
# sulu/sulu package into the node_modules directory: https://github.com/sulu/sulu/blob/2.x/symlink-vendor-directory.js
# when executing npm as root (eg. inside a docker container), npm will drop permissions when executing these scripts
# and therefore the symlink cannot be created. to prevent dropping permissions, we enable the "unsafe-perm" setting
# https://docs.npmjs.com/cli/v6/using-npm/scripts#user
unsafe-perm=true

# the javascript setup in this folder is not compatible with npm 7: https://github.com/sulu/skeleton/issues/88
# to display a helpful error message if an incompatible version is used, we enable the "engine-strict" setting
engine-strict=true

# unfortunately, npm 7 tries to resolve the dependency tree before validating the "engines" section of the
# package.json. to display a helpful message instead of a confusing dependency tree error when using npm 7, we enable
# the "legacy-peer-deps" setting: https://github.com/sulu/skeleton/issues/133#issuecomment-907271497
legacy-peer-deps=true
1 change: 1 addition & 0 deletions Tests/Application/assets/admin/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Add project specific javascript code and import of additional bundles here:
13 changes: 9 additions & 4 deletions Tests/Application/assets/admin/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"presets": [
["@babel/preset-env", {"useBuiltIns": "usage", "corejs": "3.18"}],
"@babel/preset-react"
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}],
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-flow-strip-types",
["@babel/plugin-proposal-class-properties", {"loose": true}]
]
"@babel/plugin-proposal-class-properties"
],
"assumptions": {
"setPublicClassFields": true
}
}
10 changes: 6 additions & 4 deletions Tests/Application/assets/admin/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Polyfills
import 'regenerator-runtime/runtime';
// This file should only be changed by the `bin/console sulu:admin:update-build` command:
// See https://docs.sulu.io/en/latest/upgrades/upgrade-2.x.html

// Bundles
// Sulu Core Bundles
import {startAdmin} from 'sulu-admin-bundle';
import 'sulu-audience-targeting-bundle';
import 'sulu-category-bundle';
Expand All @@ -15,9 +15,11 @@ import 'sulu-route-bundle';
import 'sulu-search-bundle';
import 'sulu-security-bundle';
import 'sulu-snippet-bundle';
import 'sulu-trash-bundle';
import 'sulu-website-bundle';

// Implement custom extensions here
// Add project specific javascript code and import of additional bundles to the following file:
import './app.js';

// Start admin application
startAdmin();
43 changes: 21 additions & 22 deletions Tests/Application/assets/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "sulu-skeleton",
"license": "MIT",
"repository": "https://github.com/sulu/skeleton.git",
"scripts": {
"preinstall": "node ../../../../vendor/sulu/sulu/preinstall.js ../../../../vendor node_modules/@sulu/vendor",
"postinstall": "node ../../../../vendor/sulu/sulu/postinstall.js ../../../../vendor node_modules/@sulu/vendor",
"preinstall": "node ../../../../vendor/sulu/sulu/preinstall.js ../../../../vendor",
"postinstall": "node ../../../../vendor/sulu/sulu/postinstall.js ../../../../vendor",
"build": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
Expand All @@ -30,38 +31,36 @@
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.16.5",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@ckeditor/ckeditor5-dev-utils": "^24.4.2",
"@ckeditor/ckeditor5-theme-lark": "^27.1.0",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
"@ckeditor/ckeditor5-dev-utils": "^30.3.2",
"@ckeditor/ckeditor5-theme-lark": "^34.2.0",
"autoprefixer": "^10.4.7",
"babel-loader": "^9.1.0",
"core-js": "^3.18.0",
"css-loader": "^5.2.4",
"css-minimizer-webpack-plugin": "^4.2.2",
"file-loader": "^6.0.0",
"glob": "^7.1.2",
"mini-css-extract-plugin": "^1.5.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss": "7.0.35",
"postcss-calc": "^7.0.5",
"postcss-hexrgba": "^2.0.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.3",
"postcss-simple-vars": "^5.0.2",
"mini-css-extract-plugin": "^2.7.1",
"postcss": "^8.4.14",
"postcss-calc": "^8.2.4",
"postcss-hexrgba": "^2.1.0",
"postcss-import": "^15.0.1",
"postcss-loader": "^7.0.2",
"postcss-nested": "^6.0.0",
"postcss-simple-vars": "^7.0.1",
"raw-loader": "^4.0.0",
"regenerator-runtime": "^0.13.3",
"webpack": "^4.27.0",
"webpack-clean-obsolete-chunks": "^0.4.0",
"webpack-cli": "^4.7.0",
"webpack-manifest-plugin": "^3.1.1"
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0",
"webpack-manifest-plugin": "^5.0.0"
},
"engines": {
"node": ">=12",
"node": ">=14",
"npm": ">=6 <7"
}
}
9 changes: 9 additions & 0 deletions Tests/Application/config/config_admin_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ security:
providers:
testprovider:
id: sulu_security.user_provider
firewalls:
test:
entry_point: sulu_security.authentication_entry_point
json_login:
check_path: sulu_admin.login_check
success_handler: sulu_security.authentication_handler
failure_handler: sulu_security.authentication_handler
logout:
path: sulu_admin.logout
9 changes: 9 additions & 0 deletions Tests/Application/config/routing_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ sulu_preview:
resource: "@SuluPreviewBundle/Resources/config/routing.yml"
prefix: /admin/preview

sulu_preview_api:
type: rest
resource: "@SuluPreviewBundle/Resources/config/routing_api.yml"
prefix: /admin/api

sulu_preview_public:
resource: "@SuluPreviewBundle/Resources/config/routing_public.yml"
prefix: /admin/p

sulu_search:
resource: "@SuluSearchBundle/Resources/config/routing.yml"
prefix: /admin/search
Expand Down
14 changes: 14 additions & 0 deletions Tests/Application/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'

services:
###> symfony/mailer ###
mailer:
image: schickling/mailcatcher
ports: [1025, 1080]
###< symfony/mailer ###

###> doctrine/doctrine-bundle ###
database:
ports:
- "3306:3306"
###< doctrine/doctrine-bundle ###
11 changes: 0 additions & 11 deletions Tests/Application/docker-compose.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions Tests/Application/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3'

services:
###> doctrine/doctrine-bundle ###
database:
# arm compatible mysql docker image
image: mysql/mysql-server:${MYSQL_VERSION:-8.0} # arm and x86/x64 compatible mysql image
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:-su_content_dev}
# You should definitely change the password in production
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-ChangeMe}
MYSQL_ROOT_HOST: '%'
volumes:
- db-data:/var/lib/mysql
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/mysql:rw
###< doctrine/doctrine-bundle ###

volumes:
###> doctrine/doctrine-bundle ###
db-data:
###< doctrine/doctrine-bundle ###
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function testCount(): void

public function testSortedByAttributes(): void
{

$example = new Example();
$dimensionContent1 = new ExampleDimensionContent($example);
$dimensionContent1->setStage('draft');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"webmozart/assert": "^1.3"
},
"require-dev": {
"coduo/php-matcher": "^3.2 || ^4.0 || ^5.0 || ^6.0",
"coduo/php-matcher": "^5.0.1 || ^6.0",
"doctrine/data-fixtures": "^1.3.3",
"doctrine/doctrine-fixtures-bundle": "^2.0 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.4",
Expand Down