This commit is contained in:
Thomas Peterson 2024-12-29 13:56:52 +01:00
parent 8fe8f9ef16
commit 316f73a740
11 changed files with 259 additions and 7 deletions

View File

@ -12,6 +12,7 @@ FROM base as ci
USER $APP_USER_NAME USER $APP_USER_NAME
run apt update && apt install chromium-driver
FROM base as local FROM base as local
#ARG APP_SSH_PASSWORD #ARG APP_SSH_PASSWORD

File diff suppressed because one or more lines are too long

View File

@ -104,6 +104,7 @@
"zfb/zfb-vm": "dev-master" "zfb/zfb-vm": "dev-master"
}, },
"require-dev": { "require-dev": {
"dbrekelmans/bdi": "^1.4",
"hautelook/alice-bundle": "^2.11", "hautelook/alice-bundle": "^2.11",
"maglnet/composer-require-checker": "4.*", "maglnet/composer-require-checker": "4.*",
"mockery/mockery": "^1.5", "mockery/mockery": "^1.5",
@ -115,6 +116,7 @@
"symfony/browser-kit": "*", "symfony/browser-kit": "*",
"symfony/css-selector": "*", "symfony/css-selector": "*",
"symfony/debug-bundle": "*", "symfony/debug-bundle": "*",
"symfony/panther": "^2.1",
"symfony/phpunit-bridge": "6.0.x-dev", "symfony/phpunit-bridge": "6.0.x-dev",
"symfony/stopwatch": "*", "symfony/stopwatch": "*",
"symfony/web-profiler-bundle": "*", "symfony/web-profiler-bundle": "*",

206
src/new/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6af99cec9f297480e6f6e2b979aefc10", "content-hash": "f4966c70ab29743cfc549b7bf648292f",
"packages": [ "packages": [
{ {
"name": "azuyalabs/yasumi", "name": "azuyalabs/yasumi",
@ -14289,6 +14289,55 @@
} }
], ],
"packages-dev": [ "packages-dev": [
{
"name": "dbrekelmans/bdi",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/dbrekelmans/bdi.git",
"reference": "fa2ff9b5ed0508ddf5cd574f9dfa6fea954a9acd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dbrekelmans/bdi/zipball/fa2ff9b5ed0508ddf5cd574f9dfa6fea954a9acd",
"reference": "fa2ff9b5ed0508ddf5cd574f9dfa6fea954a9acd",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-zip": "*",
"ext-zlib": "*",
"php": "^8.1"
},
"bin": [
"bdi",
"bdi.phar"
],
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniël Brekelmans",
"homepage": "https://github.com/dbrekelmans"
},
{
"name": "Contributors",
"homepage": "https://github.com/dbrekelmans/bdi/graphs/contributors"
}
],
"description": "PHAR distribution of dbrekelmans/browser-driver-installer.",
"homepage": "https://github.com/dbrekelmans/bdi",
"keywords": [
"browser-driver-installer"
],
"support": {
"source": "https://github.com/dbrekelmans/bdi/tree/1.4.0"
},
"time": "2024-12-12T18:36:47+00:00"
},
{ {
"name": "doctrine/data-fixtures", "name": "doctrine/data-fixtures",
"version": "1.8.0", "version": "1.8.0",
@ -15127,6 +15176,72 @@
}, },
"time": "2024-11-23T12:13:14+00:00" "time": "2024-11-23T12:13:14+00:00"
}, },
{
"name": "php-webdriver/webdriver",
"version": "1.15.2",
"source": {
"type": "git",
"url": "https://github.com/php-webdriver/php-webdriver.git",
"reference": "998e499b786805568deaf8cbf06f4044f05d91bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/998e499b786805568deaf8cbf06f4044f05d91bf",
"reference": "998e499b786805568deaf8cbf06f4044f05d91bf",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-zip": "*",
"php": "^7.3 || ^8.0",
"symfony/polyfill-mbstring": "^1.12",
"symfony/process": "^5.0 || ^6.0 || ^7.0"
},
"replace": {
"facebook/webdriver": "*"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.20.0",
"ondram/ci-detector": "^4.0",
"php-coveralls/php-coveralls": "^2.4",
"php-mock/php-mock-phpunit": "^2.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpunit/phpunit": "^9.3",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"ext-SimpleXML": "For Firefox profile creation"
},
"type": "library",
"autoload": {
"files": [
"lib/Exception/TimeoutException.php"
],
"psr-4": {
"Facebook\\WebDriver\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.",
"homepage": "https://github.com/php-webdriver/php-webdriver",
"keywords": [
"Chromedriver",
"geckodriver",
"php",
"selenium",
"webdriver"
],
"support": {
"issues": "https://github.com/php-webdriver/php-webdriver/issues",
"source": "https://github.com/php-webdriver/php-webdriver/tree/1.15.2"
},
"time": "2024-11-21T15:12:59+00:00"
},
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.12.12", "version": "1.12.12",
@ -16979,6 +17094,95 @@
], ],
"time": "2024-11-13T15:06:22+00:00" "time": "2024-11-13T15:06:22+00:00"
}, },
{
"name": "symfony/panther",
"version": "v2.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/panther.git",
"reference": "ef9a6f2393ac9679af03a93d3f508e4aa65c15b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/panther/zipball/ef9a6f2393ac9679af03a93d3f508e4aa65c15b5",
"reference": "ef9a6f2393ac9679af03a93d3f508e4aa65c15b5",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"php": ">=8.0",
"php-webdriver/webdriver": "^1.8.2",
"symfony/browser-kit": "^5.3 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.3 || ^6.0 || ^7.0",
"symfony/deprecation-contracts": "^2.4 || ^3",
"symfony/dom-crawler": "^5.3 || ^6.0 || ^7.0",
"symfony/http-client": "^5.3 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.3 || ^6.0 || ^7.0",
"symfony/process": "^5.3 || ^6.0 || ^7.0"
},
"require-dev": {
"symfony/css-selector": "^5.3 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.3 || ^6.0 || ^7.0",
"symfony/mime": "^5.3 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^5.3 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Panther\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kévin Dunglas",
"email": "dunglas@gmail.com",
"homepage": "https://dunglas.fr"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A browser testing and web scraping library for PHP and Symfony.",
"homepage": "https://dunglas.fr",
"keywords": [
"e2e",
"scraping",
"selenium",
"symfony",
"testing",
"webdriver"
],
"support": {
"issues": "https://github.com/symfony/panther/issues",
"source": "https://github.com/symfony/panther/tree/v2.1.1"
},
"funding": [
{
"url": "https://www.panthera.org/donate",
"type": "custom"
},
{
"url": "https://github.com/dunglas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/panther",
"type": "tidelift"
}
],
"time": "2023-12-03T22:17:31+00:00"
},
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "6.0.x-dev", "version": "6.0.x-dev",

Binary file not shown.

View File

@ -37,10 +37,7 @@
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" /> <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners> </listeners>
<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions> <extensions>
<extension class="Symfony\Component\Panther\ServerExtension" /> <extension class="Symfony\Component\Panther\ServerExtension" />
</extensions> </extensions>
-->
</phpunit> </phpunit>

View File

@ -38,7 +38,7 @@ class ContactRepository extends ServiceEntityRepository implements UserLoaderInt
->getQuery() ->getQuery()
->getOneOrNullResult(); ->getOneOrNullResult();
if (null === $user) { if (null === $user) {
$message = sprintf('Unable to find an active admin AppBundle:User object identified by "%s".', $username); $message = sprintf('Unable to find an Contact identified by "%s".', $username);
throw new UserNotFoundException($message); throw new UserNotFoundException($message);
} }

View File

@ -731,6 +731,15 @@
"symfony/options-resolver": { "symfony/options-resolver": {
"version": "v4.4.7" "version": "v4.4.7"
}, },
"symfony/panther": {
"version": "2.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "673836afb0eac2b0ec36c44f2ff0379e5a4b2177"
}
},
"symfony/password-hasher": { "symfony/password-hasher": {
"version": "5.3.x-dev" "version": "5.3.x-dev"
}, },

View File

@ -0,0 +1,38 @@
<?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

@ -1,7 +1,7 @@
<?php <?php
use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Dotenv;
$_SERVER['PANTHER_WEB_SERVER_DIR'] = __DIR__ .'/../web/';
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__).'/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) { if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {

View File

@ -2281,6 +2281,7 @@ class BasketController extends TP_Controller_Action
$creditSystemRest = $creditSystemRest - $art->getBrutto(); $creditSystemRest = $creditSystemRest - $art->getBrutto();
}else{ }else{
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest); $basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest);
$creditSystemRest = 0;
} }
} }
if ($basket->getPreisBrutto() < 0) { if ($basket->getPreisBrutto() < 0) {