This commit is contained in:
Thomas Peterson 2025-01-02 18:09:54 +01:00
parent 316f73a740
commit 84455cbc0d
24 changed files with 436 additions and 401 deletions

View File

@ -8,7 +8,7 @@ services:
dockerfile: ./.docker/images/php/base/Dockerfile dockerfile: ./.docker/images/php/base/Dockerfile
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" #- "linux/arm64"
args: args:
- ALPINE_VERSION=${ALPINE_VERSION?} - ALPINE_VERSION=${ALPINE_VERSION?}
- APP_CODE_PATH=${APP_CODE_PATH_CONTAINER?} - APP_CODE_PATH=${APP_CODE_PATH_CONTAINER?}

View File

@ -7,7 +7,7 @@ services:
context: ../ context: ../
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" # - "linux/arm64"
dockerfile: ./images/php/application/Dockerfile dockerfile: ./images/php/application/Dockerfile
target: ${ENV?} target: ${ENV?}
args: args:

View File

@ -7,7 +7,7 @@ services:
context: ../ context: ../
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" # - "linux/arm64"
dockerfile: ./images/php/fpm/Dockerfile dockerfile: ./images/php/fpm/Dockerfile
target: ${ENV?} target: ${ENV?}
args: args:
@ -19,7 +19,7 @@ services:
context: ../ context: ../
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" # - "linux/arm64"
dockerfile: ./images/php/cron/Dockerfile dockerfile: ./images/php/cron/Dockerfile
target: ${ENV?} target: ${ENV?}
args: args:
@ -32,7 +32,7 @@ services:
context: ../../ context: ../../
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" # - "linux/arm64"
dockerfile: ./.docker/images/nginx/Dockerfile dockerfile: ./.docker/images/nginx/Dockerfile
target: ${ENV?} target: ${ENV?}
args: args:

View File

@ -58,14 +58,20 @@ services:
image: registry.gitlab.com/printshopcreator/docker/docker_tp:v22x0x1 image: registry.gitlab.com/printshopcreator/docker/docker_tp:v22x0x1
networks: networks:
- network - network
chrome:
image: selenium/standalone-chrome:latest
ports:
- "7900:7900"
- "4444:4444"
networks:
- network
application: application:
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/application-${ENV?}:${TAG?} image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/application-${ENV?}:${TAG?}
build: build:
context: ../ context: ../
platforms: platforms:
- "linux/amd64" - "linux/amd64"
- "linux/arm64" #- "linux/arm64"
dockerfile: ./images/php/application/Dockerfile dockerfile: ./images/php/application/Dockerfile
args: args:
- BASE_IMAGE=${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-base-${ENV?}:${TAG?} - BASE_IMAGE=${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-base-${ENV?}:${TAG?}
@ -83,11 +89,14 @@ services:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
ports: ports:
- "${APPLICATION_SSH_HOST_PORT:-2222}:22" - "${APPLICATION_SSH_HOST_PORT:-2222}:22"
- "${APPLICATION_PANTHER_HOST_PORT:-9001}:9001"
tty: true tty: true
networks: networks:
- network - network
extra_hosts: extra_hosts:
- host.docker.internal:host-gateway - host.docker.internal:host-gateway
depends_on:
- chrome
mongodb: mongodb:
image: mongo:${MONGODB_VERSION?} image: mongo:${MONGODB_VERSION?}
volumes: volumes:

View File

@ -5,4 +5,6 @@ CORS_ALLOW_ORIGIN=*
DATABASE_URL=sqlite:///%kernel.project_dir%/var/test.sqlite DATABASE_URL=sqlite:///%kernel.project_dir%/var/test.sqlite
MONGODB_DB=psc_test MONGODB_DB=psc_test
DATABASE_URL=mysql://root:Wichtig1@mysql:3306/psc_test DATABASE_URL=mysql://root:Wichtig1@mysql:3306/psc_test
PANTHER_NO_SANDBOX=0
PANTHER_WEB_SERVER_PORT=9001
PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage'

611
src/new/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['test' => true, 'session' => ['storage_factory_id' => 'session.storage.factory.php_bridge']]); $containerConfigurator->extension('framework', ['test' => true, 'session' => ['storage_factory_id' => 'session.storage.factory.mock_file']]);
}; };

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
use PSC\Shop\EntityBundle\Entity\Contact;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension(
'security',
[
'password_hashers' =>
[
Contact::class =>
['algorithm' => 'auto']
],
]
);
};

View File

@ -73,7 +73,7 @@ PSC\Shop\EntityBundle\Entity\Product:
<option id="auflage" name="Auflage" type="Input" default="10"/> <option id="auflage" name="Auflage" type="Input" default="10"/>
<option id="calc_rabatt" type="Hidden"> <option id="calc_rabatt" type="Hidden">
<contact.accountType> <contact.accountType default="1">
<grenze calc_value="1">0-1</grenze> <grenze calc_value="1">0-1</grenze>
<grenze calc_value="0.8">2</grenze> <grenze calc_value="0.8">2</grenze>
<grenze calc_value="0.5">3</grenze> <grenze calc_value="0.5">3</grenze>

View File

@ -11,7 +11,7 @@
<label class="text-sm font-medium leading-4 text-gray-700" for="password">{{ 'psc_backend_dashboard.password'|trans }}:</label> <label class="text-sm font-medium leading-4 text-gray-700" for="password">{{ 'psc_backend_dashboard.password'|trans }}:</label>
<input type="password" class="mt-1 block w-full rounded-lg shadow-sm outline-none border-gray-300 focus:border-psc-500 focus:ring-1 focus:ring-inset focus:ring-psc-500" id="password" name="password" /> <input type="password" class="mt-1 block w-full rounded-lg shadow-sm outline-none border-gray-300 focus:border-psc-500 focus:ring-1 focus:ring-inset focus:ring-psc-500" id="password" name="password" />
<button type="submit" class="mt-4 inline-flex items-center justify-center font-medium rounded-lg transition-colors min-h-[2.25rem] px-4 text-sm text-white shadow w-full bg-psc-500">{{ 'psc_backend_dashboard.login'|trans }}</button> <button id="login" type="submit" class="mt-4 inline-flex items-center justify-center font-medium rounded-lg transition-colors min-h-[2.25rem] px-4 text-sm text-white shadow w-full bg-psc-500">{{ 'psc_backend_dashboard.login'|trans }}</button>
<input type="hidden" name="_csrf_token" <input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}" value="{{ csrf_token('authenticate') }}"
> >

View File

@ -107,7 +107,7 @@
<b class="inline-flex items-center justify-center ml-auto rtl:ml-0 rtl:mr-auto min-h-4 px-2 py-0.5 text-xs font-medium tracking-tight rounded-xl whitespace-normal"><i class="fas fa-chevron-left"></i></b> <b class="inline-flex items-center justify-center ml-auto rtl:ml-0 rtl:mr-auto min-h-4 px-2 py-0.5 text-xs font-medium tracking-tight rounded-xl whitespace-normal"><i class="fas fa-chevron-left"></i></b>
</a> </a>
{% else %} {% else %}
<a class="flex items-center justify-center gap-3 px-3 py-2 rounded-lg font-medium transition hover:bg-psc-500 focus:bg-psc-500 hover:text-white focus:text-white" href="{{ item.uri }}"{{ macros.attributes(item.linkAttributes) }}> <a class="flex items-center justify-center gap-3 px-3 py-2 rounded-lg font-medium transition hover:bg-psc-500 focus:bg-psc-500 hover:text-white focus:text-white" id="{{ item.label }}" title="{{ item.label }}" href="{{ item.uri }}"{{ macros.attributes(item.linkAttributes) }}>
<i class="{{ item.getExtra('icon') }}"></i> <i class="{{ item.getExtra('icon') }}"></i>
<div class="flex flex-1" x-show="$store.sideBar.isOpen">{{ block('label') }} {% if item.getExtra('error') > 0 %}<span class="badge bg-danger">({{ item.getExtra('error') }})</span>{% endif %}</div> <div class="flex flex-1" x-show="$store.sideBar.isOpen">{{ block('label') }} {% if item.getExtra('error') > 0 %}<span class="badge bg-danger">({{ item.getExtra('error') }})</span>{% endif %}</div>
</a> </a>

View File

@ -502,6 +502,4 @@ class Contact
{ {
$this->countryCode = $countryCode; $this->countryCode = $countryCode;
} }
} }

View File

@ -208,9 +208,7 @@ class Contact
#[Field(type: 'string')] #[Field(type: 'string')]
protected $layouterSettings; protected $layouterSettings;
/**
* @var float $priceFactor;
*/
#[Field(type: 'float')] #[Field(type: 'float')]
protected $priceFactor; protected $priceFactor;
@ -877,5 +875,4 @@ class Contact
{ {
$this->layouterCountryCode = $layouterCountryCode; $this->layouterCountryCode = $layouterCountryCode;
} }
} }

View File

@ -33,7 +33,5 @@ class PSCShopUserBundle extends Bundle
public function build(ContainerBuilder $container) public function build(ContainerBuilder $container)
{ {
parent::build($container); parent::build($container);
// $extension = $container->getExtension('security');
// $extension->addAuthenticatorFactory(new pscAppFactory());
} }
} }

View File

@ -7,7 +7,7 @@
<option id="auflage" name="Auflage" type="Input" default="10"/> <option id="auflage" name="Auflage" type="Input" default="10"/>
<option id="calc_rabatt" type="Hidden"> <option id="calc_rabatt" type="Hidden">
<contact.accountType> <contact.accountType default="1">
<grenze calc_value="1">1</grenze> <grenze calc_value="1">1</grenze>
<grenze calc_value="0.8">2</grenze> <grenze calc_value="0.8">2</grenze>
<grenze calc_value="0.5">3</grenze> <grenze calc_value="0.5">3</grenze>

View File

@ -0,0 +1,52 @@
<?php
namespace Plugins\System\PSC\Invoice\App;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\Panther\Client;
use Symfony\Component\Panther\PantherTestCase;
use Symfony\Component\Panther\ServerExtension;
use Tests\RefreshDatabaseTrait;
class LoginPantherTest extends PantherTestCase
{
use RefreshDatabaseTrait;
protected $client;
private function createClientManually(): Client
{
self::bootKernel();
$chromeOptions = new ChromeOptions();
$chromeOptions->addArguments(['--window-size=1200,1100', '--disable-gpu',]);
$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability(ChromeOptions::CAPABILITY, $chromeOptions);
self::$pantherClient = Client::createSeleniumClient(
'http://chrome:4444',
$capabilities,
'http://application:9001'
);
ServerExtension::registerClient(self::$pantherClient);
// you can avoid having to use Closure::bind if you use PantherTestCaseTrait directly
\Closure::bind(function(AbstractBrowser $client) {
// contrary to the name, calling it with argument will set local static variable inside getClient method
self::getClient($client);
}, null, PantherTestCase::class)(self::$pantherClient);
return self::$pantherClient;
}
public function testLogin(): void
{
static::startWebServer(['hostname' => 'application']);
$this->client = $this->createClientManually();
$this->client->get('/backend/login');
$crawler = $this->client->submitForm('login', ['username' => 'admin@shop.de', 'password' => 'shop2014']);
$this->client->get('/backend/dashboard');
$this->assertSelectorTextContains('h1', 'Dashboard');
$this->client->clickLink('CMS');
$this->assertSelectorTextContains('h3', 'CMS');
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace Plugins\System\PSC\Invoice\App;
use PSC\Shop\ContactBundle\Repository\ContactRepository;
use Symfony\Component\Panther\PantherTestCase;
use Tests\RefreshDatabaseTrait;
class LoginTest extends PantherTestCase
{
use RefreshDatabaseTrait;
public function testLogin(): void
{
$client = static::createPantherClient(); // Your app is automatically started using the built-in web server
$client->request('GET', '/backend/login');
$this->assertPageTitleContains('PSC Admin');
}
public function testCreateInvoice(): void
{
$client = static::createPantherClient(); // Your app is automatically started using the built-in web server
$userRepository = static::getContainer()->get(ContactRepository::class);
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
$client->loginUser($testUser, 'backend');
$client->request('GET', '/backend/component/invoice/index/create');
$this->assertPageTitleContains('PSC Invoice');
}
}

View File

@ -76,7 +76,7 @@ class CreateOrderTest extends WebTestCase
<option id="auflage" name="Auflage" type="Input" default="10"/> <option id="auflage" name="Auflage" type="Input" default="10"/>
<option id="calc_rabatt" type="Hidden"> <option id="calc_rabatt" type="Hidden">
<contact.accountType> <contact.accountType default="1">
<grenze calc_value="1">1</grenze> <grenze calc_value="1">1</grenze>
<grenze calc_value="0.8">2</grenze> <grenze calc_value="0.8">2</grenze>
<grenze calc_value="0.5">3</grenze> <grenze calc_value="0.5">3</grenze>
@ -185,7 +185,7 @@ class CreateOrderTest extends WebTestCase
<option id="auflage" name="Auflage" type="Input" default="10"/> <option id="auflage" name="Auflage" type="Input" default="10"/>
<option id="calc_rabatt" type="Hidden"> <option id="calc_rabatt" type="Hidden">
<contact.accountType> <contact.accountType default="1">
<grenze calc_value="1">1</grenze> <grenze calc_value="1">1</grenze>
<grenze calc_value="0.8">2</grenze> <grenze calc_value="0.8">2</grenze>
<grenze calc_value="0.5">3</grenze> <grenze calc_value="0.5">3</grenze>

View File

@ -29,4 +29,4 @@ class ConfigureMenuListener
)); ));
} }
} }
} }

View File

@ -28,13 +28,13 @@ class ConfigureMenuListener
if ($this->authorizationChecker->isGranted('ROLE_ADMIN')) { if ($this->authorizationChecker->isGranted('ROLE_ADMIN')) {
$menu = $event->getMenu(); $menu = $event->getMenu();
$menu->addChild('Sendcloud', array( $menu->addChild('Sendcloud R1', array(
'route' => 'psc_shop_sendcloud_backend_list_index', 'route' => 'psc_shop_sendcloud_backend_list_index',
'extras' => array( 'extras' => array(
'icon' => 'fas fa-archive', 'icon' => 'fas fa-archive',
'orderNumber' => 11 'orderNumber' => 10
) )
)); ));
} }
} }
} }

View File

@ -133,11 +133,8 @@ class GetPrice extends AbstractController
$contact = new Contact(); $contact = new Contact();
$this->contactTransformer->fromDb($contact, $this->tokenStorage->getToken()->getUser()); $this->contactTransformer->fromDb($contact, $this->tokenStorage->getToken()->getUser());
$engine->setVariable('contact.accountType', $contact->getAccountType()->value); $engine->setVariable('contact.accountType', $contact->getAccountType()->value);
} else { $engine->setVariable('contact.account', $contact->getAccount()->getUid());
$engine->setVariable('contact.accountType', 1);
} }
if ($data->xmlProduct != "") { if ($data->xmlProduct != "") {
$engine->setActiveArticle($data->xmlProduct); $engine->setActiveArticle($data->xmlProduct);
} }

View File

@ -97,10 +97,8 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
$this->engine->setVariables($specProd->getParams()); $this->engine->setVariables($specProd->getParams());
if ($this->contact && $this->contact->getAccountType()->value > 1) { if ($this->contact && $this->contact->getAccountType()->value > 1) {
$this->engine->setVariable('contact.accountType', $this->contact->getAccountType()->value); $this->engine->setVariable('contact.accountType', $this->contact->getAccountType()->value);
} else { $this->engine->setVariable('contact.account', $this->contact->getAccount()->getUid());
$this->engine->setVariable('contact.accountType', 1); }
}
$this->engine->calc(); $this->engine->calc();
} }
} }

View File

@ -1,21 +1,20 @@
{ {
"/apps/backend/login.css": "/apps/build/backend/login.css", "build/backend/login.css": "/apps/build/backend/login.5a878154.css",
"/apps/backend/login.js": "/apps/build/backend/login.js", "build/backend/login.js": "/apps/build/backend/login.ab0272c2.js",
"/apps/backend/dashboard.css": "/apps/build/backend/dashboard.css", "build/backend/dashboard.css": "/apps/build/backend/dashboard.f30e17f9.css",
"/apps/backend/dashboard.js": "/apps/build/backend/dashboard.js", "build/backend/dashboard.js": "/apps/build/backend/dashboard.94d49736.js",
"/apps/backend/tailwind.css": "/apps/build/backend/tailwind.css", "build/backend/tailwind.css": "/apps/build/backend/tailwind.420ea542.css",
"/apps/backend/tailwind.js": "/apps/build/backend/tailwind.js", "build/backend/tailwind.js": "/apps/build/backend/tailwind.b522fe24.js",
"/apps/runtime.js": "/apps/build/runtime.js", "build/runtime.js": "/apps/build/runtime.44b7f9b9.js",
"/apps/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-8b4fee.css": "/apps/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-8b4fee.css", "build/198.a02632c1.js": "/apps/build/198.a02632c1.js",
"/apps/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-8b4fee.js": "/apps/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-8b4fee.js", "build/857.e053f864.css": "/apps/build/857.e053f864.css",
"/apps/vendors-node_modules_popperjs_core_dist_cjs_popper_js-node_modules_bootstrap-toggle_js_bootst-2e5edb.css": "/apps/build/vendors-node_modules_popperjs_core_dist_cjs_popper_js-node_modules_bootstrap-toggle_js_bootst-2e5edb.css", "build/857.c01d761c.js": "/apps/build/857.c01d761c.js",
"/apps/vendors-node_modules_popperjs_core_dist_cjs_popper_js-node_modules_bootstrap-toggle_js_bootst-2e5edb.js": "/apps/build/vendors-node_modules_popperjs_core_dist_cjs_popper_js-node_modules_bootstrap-toggle_js_bootst-2e5edb.js", "build/280.f481306d.js": "/apps/build/280.f481306d.js",
"/apps/vendors-node_modules_alpinejs_persist_dist_module_esm_js-node_modules_alpinejs_dist_module_esm_js.js": "/apps/build/vendors-node_modules_alpinejs_persist_dist_module_esm_js-node_modules_alpinejs_dist_module_esm_js.js", "build/933.ca932d10.js": "/apps/build/933.ca932d10.js",
"/apps/node_modules_symfony_stimulus-bridge_dist_webpack_loader_js_assets_controllers_json.js": "/apps/build/node_modules_symfony_stimulus-bridge_dist_webpack_loader_js_assets_controllers_json.js", "build/fonts/summernote.eot": "/apps/build/fonts/summernote.7a3f9776.eot",
"/apps/fonts/summernote.eot": "/apps/build/fonts/summernote.7a3f9776.eot", "build/fonts/summernote.ttf": "/apps/build/fonts/summernote.eb23b6b7.ttf",
"/apps/fonts/summernote.ttf": "/apps/build/fonts/summernote.eb23b6b7.ttf", "build/fonts/summernote.woff": "/apps/build/fonts/summernote.f2bec4f2.woff",
"/apps/fonts/summernote.woff": "/apps/build/fonts/summernote.f2bec4f2.woff", "build/fonts/summernote.woff2": "/apps/build/fonts/summernote.f19578ae.woff2",
"/apps/fonts/summernote.woff2": "/apps/build/fonts/summernote.f19578ae.woff2", "build/images/logo.png": "/apps/build/images/logo.png",
"/apps/images/logo.png": "/apps/build/images/logo.png", "build/images/logo.png:Zone.Identifier": "/apps/build/images/logo.png:Zone.Identifier"
"/apps/images/logo.png:Zone.Identifier": "/apps/build/images/logo.png:Zone.Identifier"
} }

View File

@ -6,9 +6,14 @@ if (!Encore.isRuntimeEnvironmentConfigured()) {
} }
Encore Encore
.setOutputPath('web/build/') .setOutputPath('web/build/');
.setPublicPath('/apps/build') if (process.env.NODE_ENV == 'test') {
.setManifestKeyPrefix('/apps') Encore.setPublicPath('/build')
}else{
Encore.setPublicPath('/apps/build')
}
Encore.setManifestKeyPrefix('build')
.addEntry('backend/login', './assets/backend/login/login.ts') .addEntry('backend/login', './assets/backend/login/login.ts')
.addEntry('backend/dashboard', './assets/backend/dashboard/dashboard.js') .addEntry('backend/dashboard', './assets/backend/dashboard/dashboard.js')