Commit a9f4db29 authored by Tobias Munk's avatar Tobias Munk

updated tests

parent 4ce63b7f
FROM phundament/app:4.3.0-beta6
RUN composer require -vv beowulfenator/yii2-json-editor
\ No newline at end of file
FROM registry-v2.hrzg.de/hrzg/ee:latest
.PHONY: build test
DOCKER_COMPOSE ?= docker-compose
WEB_SERVICE ?= nginx
PHP_SERVICE ?= phpfpm
DB_SERVICE ?= db
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
OPEN_CMD ?= open
DOCKER_HOST_IP ?= $(shell echo $(DOCKER_HOST) | sed 's/tcp:\/\///' | sed 's/:[0-9.]*//')
else
OPEN_CMD ?= xdg-open
DOCKER_HOST_IP ?= 127.0.0.1
endif
all: build up setup open
build:
$(shell echo $(shell git describe --long --tags --dirty --always) > src/version)
@echo $(shell cat src/version)
$(DOCKER_COMPOSE) build --pull
up:
$(DOCKER_COMPOSE) up -d
clean:
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) rm -fv --all
$(DOCKER_COMPOSE) down --rmi local --remove-orphans
open: ##@docker open application web service in browser
$(OPEN_CMD) http://$(DOCKER_HOST_IP):$(shell $(DOCKER_COMPOSE) port $(WEB_SERVICE) 80 | sed 's/[0-9.]*://')
open-db: ##@docker open application web service in browser
$(OPEN_CMD) mysql://root:secret@$(DOCKER_HOST_IP):$(shell $(DOCKER_COMPOSE) port $(DB_SERVICE) 3306 | sed 's/[0-9.]*://')
bash: ##@docker open application development bash
$(DOCKER_COMPOSE) run --rm $(PHP_SERVICE) bash
setup: ##@docker open application development bash
-$(DOCKER_COMPOSE) run --rm $(PHP_SERVICE) yii db/create
-$(DOCKER_COMPOSE) run --rm $(PHP_SERVICE) yii migrate
lint:
mkdir -p _artifacts/lint && chmod -R 777 _artifacts/lint
docker run --rm -v "${PWD}:/project" jolicode/phaudit php-cs-fixer fix --format=txt -v --dry-run src || export ERROR=1; \
docker run --rm -v "${PWD}:/project" jolicode/phaudit phpmetrics --report-html=_artifacts/lint/metrics.html src/ || ERROR=1; \
docker run --rm -v "${PWD}:/project" jolicode/phaudit phpmd src html cleancode,codesize,controversial,design,unusedcode,tests/phpmd/naming.xml > _artifacts/lint/mess.html || ERROR=1; \
exit ${ERROR}
\ No newline at end of file
<?php
use schmunk42\giiant\generators\crud\callbacks\base\Callback;
use schmunk42\giiant\generators\crud\callbacks\yii\Db;
use schmunk42\giiant\generators\crud\callbacks\yii\Html;
$aceEditorField = function ($attribute, $model, $generator) {
return "\$form->field(\$model, '{$attribute}')->widget(\\trntv\\aceeditor\\AceEditor::className())";
};
$jsonEditorField = function ($attribute, $model, $generator) {
return <<<CODE
\$form->field(\$model, '{$attribute}')->widget(beowulfenator\\JsonEditor\\JsonEditorWidget::className(), [
'schema' => \yii\helpers\Json::decode(hrzg\widget\models\crud\WidgetTemplate::find(['id'=>1])->one()->json_schema),
'clientOptions' => [
#'theme' => 'bootstrap3',
'disable_collapse' => true,
'disable_edit_json' => true,
'disable_properties' => true,
'no_additional_properties' => true,
],
]);
CODE;
};
\Yii::$container->set(
'schmunk42\giiant\generators\crud\providers\CallbackProvider',
[
'columnFormats' => [
// hide system fields, but not ID in table
'created_at$|updated_at$' => Callback::false(),
// hide all TEXT or TINYTEXT columns
'.*' => Db::falseIfText(),
],
'activeFields' => [
// hide system fields in form
'id$' => Db::falseIfAutoIncrement(),
'id$|created_at$|updated_at$' => Callback::false(),
'schema$' => $aceEditorField,
'json' => $jsonEditorField,
],
'attributeFormats' => [
// render HTML output
'_html$' => Html::attribute(),
],
]
);
\ No newline at end of file
......@@ -25,6 +25,7 @@ services:
DB_PORT_3306_TCP_PORT: 3306
DB_ENV_MYSQL_ROOT_USER: root
DB_ENV_MYSQL_ROOT_PASSWORD: secretadmin
MYSQL_PASSWORD: secretadmin
volumes:
- /app
- ../:/app/vendor/hrzg/yii2-widgets2-module
......@@ -38,7 +39,7 @@ services:
MYSQL_ROOT_PASSWORD: secretadmin
seleniumfirefox:
image: 'selenium/standalone-firefox-debug:2.47.1'
image: 'selenium/standalone-firefox-debug:2.53.0'
expose:
- '4444'
ports:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment