endofday: 17.01.2024
This commit is contained in:
parent
556d3cee7c
commit
9286839d99
@ -1,4 +1,4 @@
|
|||||||
name: symfonCrud
|
name: symfonycrud
|
||||||
type: php
|
type: php
|
||||||
docroot: public
|
docroot: public
|
||||||
php_version: "8.2"
|
php_version: "8.2"
|
||||||
@ -12,15 +12,14 @@ database:
|
|||||||
use_dns_when_possible: true
|
use_dns_when_possible: true
|
||||||
composer_version: "2"
|
composer_version: "2"
|
||||||
web_environment: []
|
web_environment: []
|
||||||
|
nodejs_version: "18"
|
||||||
|
|
||||||
# Key features of DDEV's config.yaml:
|
# Key features of DDEV's config.yaml:
|
||||||
|
|
||||||
# name: <projectname> # Name of the project, automatically provides
|
# name: <projectname> # Name of the project, automatically provides
|
||||||
# http://projectname.ddev.site and https://projectname.ddev.site
|
# http://projectname.ddev.site and https://projectname.ddev.site
|
||||||
|
|
||||||
# type: <projecttype> # backdrop, craftcms, django4, drupal6/7/8/9/10, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress
|
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
|
||||||
# See https://ddev.readthedocs.io/en/latest/users/quickstart/ for more
|
|
||||||
# information on the different project types
|
|
||||||
|
|
||||||
# docroot: <relative_path> # Relative path to the directory containing index.php.
|
# docroot: <relative_path> # Relative path to the directory containing index.php.
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ web_environment: []
|
|||||||
# type: <dbtype> # mysql, mariadb, postgres
|
# type: <dbtype> # mysql, mariadb, postgres
|
||||||
# version: <version> # database version, like "10.4" or "8.0"
|
# version: <version> # database version, like "10.4" or "8.0"
|
||||||
# MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0
|
# MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0
|
||||||
# PostgreSQL versions can be 9-16.
|
# PostgreSQL versions can be 9-15.
|
||||||
|
|
||||||
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
|
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
|
||||||
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
|
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
|
||||||
@ -76,13 +75,9 @@ web_environment: []
|
|||||||
# To reinstall Composer after the image was built, run "ddev debug refresh".
|
# To reinstall Composer after the image was built, run "ddev debug refresh".
|
||||||
|
|
||||||
# nodejs_version: "18"
|
# nodejs_version: "18"
|
||||||
# change from the default system Node.js version to any other version.
|
# change from the default system Node.js version to another supported version, like 14, 16, 18, 20.
|
||||||
# Numeric version numbers can be complete (i.e. 18.15.0) or
|
# Note that you can use 'ddev nvm' or nvm inside the web container to provide nearly any
|
||||||
# incomplete (18, 17.2, 16). 'lts' and 'latest' can be used as well along with
|
# Node.js version, including v6, etc.
|
||||||
# other named releases.
|
|
||||||
# see https://www.npmjs.com/package/n#specifying-nodejs-versions
|
|
||||||
# Note that you can continue using 'ddev nvm' or nvm inside the web container
|
|
||||||
# to change the project's installed node version if you need to.
|
|
||||||
|
|
||||||
# additional_hostnames:
|
# additional_hostnames:
|
||||||
# - somename
|
# - somename
|
||||||
@ -110,13 +105,6 @@ web_environment: []
|
|||||||
# If true, turns off the normal warning that says
|
# If true, turns off the normal warning that says
|
||||||
# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set"
|
# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set"
|
||||||
|
|
||||||
# ddev_version_constraint: ""
|
|
||||||
# Example:
|
|
||||||
# ddev_version_constraint: ">= 1.22.4"
|
|
||||||
# This will enforce that the running ddev version is within this constraint.
|
|
||||||
# See https://github.com/Masterminds/semver#checking-version-constraints for
|
|
||||||
# supported constraint formats
|
|
||||||
|
|
||||||
# working_dir:
|
# working_dir:
|
||||||
# web: /var/www/html
|
# web: /var/www/html
|
||||||
# db: /home
|
# db: /home
|
||||||
@ -253,10 +241,10 @@ web_environment: []
|
|||||||
# override_config: false
|
# override_config: false
|
||||||
# By default, config.*.yaml files are *merged* into the configuration
|
# By default, config.*.yaml files are *merged* into the configuration
|
||||||
# But this means that some things can't be overridden
|
# But this means that some things can't be overridden
|
||||||
# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge
|
# For example, if you have 'nfs_mount_enabled: true'' you can't override it with a merge
|
||||||
# and you can't erase existing hooks or all environment variables.
|
# and you can't erase existing hooks or all environment variables.
|
||||||
# However, with "override_config: true" in a particular config.*.yaml file,
|
# However, with "override_config: true" in a particular config.*.yaml file,
|
||||||
# 'use_dns_when_possible: false' can override the existing values, and
|
# 'nfs_mount_enabled: false' can override the existing values, and
|
||||||
# hooks:
|
# hooks:
|
||||||
# post-start: []
|
# post-start: []
|
||||||
# or
|
# or
|
||||||
|
6
.env.test
Normal file
6
.env.test
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# define your env variables for the test env here
|
||||||
|
KERNEL_CLASS='App\Kernel'
|
||||||
|
APP_SECRET='$ecretf0rt3st'
|
||||||
|
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||||
|
PANTHER_APP_ENV=panther
|
||||||
|
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -8,3 +8,8 @@
|
|||||||
/var/
|
/var/
|
||||||
/vendor/
|
/vendor/
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
|
###> phpunit/phpunit ###
|
||||||
|
/phpunit.xml
|
||||||
|
.phpunit.result.cache
|
||||||
|
###< phpunit/phpunit ###
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
<Configuration>
|
<Configuration>
|
||||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration>
|
|
||||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
|
||||||
</Configuration>
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
14
.idea/dataSources.xml
Normal file
14
.idea/dataSources.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="DDEV" uuid="07604630-4c95-4340-b0eb-dede0a6f4b43">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<configured-by-url>true</configured-by-url>
|
||||||
|
<remarks>DDEV generated data source</remarks>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://127.0.0.1:27702/db?user=db&password=db</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -64,8 +64,58 @@
|
|||||||
<path value="$PROJECT_DIR$/vendor/symfony/maker-bundle" />
|
<path value="$PROJECT_DIR$/vendor/symfony/maker-bundle" />
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/process" />
|
<path value="$PROJECT_DIR$/vendor/symfony/process" />
|
||||||
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
|
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/lines-of-code" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/object-reflector" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/complexity" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/php-invoker" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/sebastian/cli-parser" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phar-io/version" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phar-io/manifest" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
|
||||||
</include_path>
|
</include_path>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PhpInterpreters">
|
||||||
|
<interpreters>
|
||||||
|
<interpreter id="457a2d38-c3b5-4cc5-ac28-6991269010fa" name="DDEV" home="docker-compose://DATA" auto="false" debugger_id="php.debugger.XDebug">
|
||||||
|
<remote_data INTERPRETER_PATH="php8.2" HELPERS_PATH="/opt/.phpstorm_helpers" VALID="true" RUN_AS_ROOT_VIA_SUDO="false" DOCKER_ACCOUNT_NAME="Docker" DOCKER_COMPOSE_SERVICE_NAME="web" DOCKER_REMOTE_PROJECT_PATH="/opt/project">
|
||||||
|
<PathMappingSettings>
|
||||||
|
<option name="pathMappings">
|
||||||
|
<list>
|
||||||
|
<mapping local-root="$PROJECT_DIR$" remote-root="/var/www/html" />
|
||||||
|
<mapping local-root="/mnt/c/Users/jklattenhoff/Documents/symfony_crud/.ddev" remote-root="/mnt/ddev_config" />
|
||||||
|
<mapping local-root="/mnt/c/Users/jklattenhoff/Documents/symfony_crud/.ddev/xhprof" remote-root="/usr/local/bin/xhprof" />
|
||||||
|
<mapping local-root="$APPLICATION_CONFIG_DIR$/scratches" remote-root="/opt/scratches" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</PathMappingSettings>
|
||||||
|
<type_data command="EXEC" />
|
||||||
|
<dockerComposeConfigurationPaths>
|
||||||
|
<item value="$PROJECT_DIR$/.ddev/.ddev-docker-compose-full.yaml" />
|
||||||
|
</dockerComposeConfigurationPaths>
|
||||||
|
<envs>
|
||||||
|
<env name="COMPOSE_PROJECT_NAME" value="ddev-symfonCrud" />
|
||||||
|
</envs>
|
||||||
|
</remote_data>
|
||||||
|
</interpreter>
|
||||||
|
</interpreters>
|
||||||
|
</component>
|
||||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
||||||
<component name="PhpStanOptionsConfiguration">
|
<component name="PhpStanOptionsConfiguration">
|
||||||
<option name="transferred" value="true" />
|
<option name="transferred" value="true" />
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
<PhpSpecSuiteConfiguration>
|
<PhpSpecSuiteConfiguration>
|
||||||
<option name="myPath" value="$PROJECT_DIR$" />
|
<option name="myPath" value="$PROJECT_DIR$" />
|
||||||
</PhpSpecSuiteConfiguration>
|
</PhpSpecSuiteConfiguration>
|
||||||
|
<PhpSpecSuiteConfiguration>
|
||||||
|
<option name="myPath" value="$PROJECT_DIR$" />
|
||||||
|
</PhpSpecSuiteConfiguration>
|
||||||
</suites>
|
</suites>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
16
.idea/remote-mappings.xml
Normal file
16
.idea/remote-mappings.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteMappingsManager">
|
||||||
|
<list>
|
||||||
|
<list>
|
||||||
|
<remote-mappings server-id="php@457a2d38-c3b5-4cc5-ac28-6991269010fa">
|
||||||
|
<settings>
|
||||||
|
<list>
|
||||||
|
<mapping local-root="$PROJECT_DIR$" remote-root="/var/www/html" />
|
||||||
|
</list>
|
||||||
|
</settings>
|
||||||
|
</remote-mappings>
|
||||||
|
</list>
|
||||||
|
</list>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -3,6 +3,7 @@
|
|||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="App\Tests\" />
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="App\Tests\" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/var" />
|
<excludeFolder url="file://$MODULE_DIR$/var" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||||
@ -21,11 +22,35 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/persistence" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/persistence" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/sql-formatter" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/sql-formatter" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/manifest" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/version" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-invoker" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/cache" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/cli-parser" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/complexity" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/diff" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/lines-of-code" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-reflector" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/type" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/version" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/cache" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/cache-contracts" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/cache-contracts" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/config" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/config" />
|
||||||
@ -57,6 +82,7 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-exporter" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-exporter" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "10.*",
|
||||||
"symfony/maker-bundle": "^1.52"
|
"symfony/maker-bundle": "^1.52"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1559
composer.lock
generated
1559
composer.lock
generated
File diff suppressed because it is too large
Load Diff
31
migrations/Version20240117152633.php
Normal file
31
migrations/Version20240117152633.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20240117152633 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE printer (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, build_volume VARCHAR(255) NOT NULL, max_speed DOUBLE PRECISION NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP TABLE printer');
|
||||||
|
}
|
||||||
|
}
|
38
phpunit.xml.dist
Normal file
38
phpunit.xml.dist
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
|
colors="true"
|
||||||
|
bootstrap="tests/bootstrap.php"
|
||||||
|
convertDeprecationsToExceptions="false"
|
||||||
|
>
|
||||||
|
<php>
|
||||||
|
<ini name="display_errors" value="1" />
|
||||||
|
<ini name="error_reporting" value="-1" />
|
||||||
|
<server name="APP_ENV" value="test" force="true" />
|
||||||
|
<server name="SHELL_VERBOSITY" value="-1" />
|
||||||
|
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
|
||||||
|
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
|
||||||
|
</php>
|
||||||
|
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Project Test Suite">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<coverage processUncoveredFiles="true">
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">src</directory>
|
||||||
|
</include>
|
||||||
|
</coverage>
|
||||||
|
|
||||||
|
<listeners>
|
||||||
|
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||||
|
</listeners>
|
||||||
|
|
||||||
|
<extensions>
|
||||||
|
</extensions>
|
||||||
|
</phpunit>
|
@ -2,18 +2,33 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Printer;
|
||||||
|
use App\Repository\PrinterRepository;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class PrinterCrudController extends AbstractController
|
class PrinterCrudController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/printer/crud', name: 'app_printer_crud')]
|
public function __construct(private readonly PrinterRepository $printerRepository)
|
||||||
public function index(): JsonResponse
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/printer', name: 'printer')]
|
||||||
|
public function printer(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->json($this->printerRepository->findAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/printer/{id}', name: 'app_printer', methods: ["GET"])]
|
||||||
|
public function index(?Printer $printer): JsonResponse
|
||||||
|
{
|
||||||
|
if (!$printer) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'message' => 'Welcome to your new controller!',
|
'message' => 'printer does not exist',
|
||||||
'path' => 'src/Controller/PrinterCrudController.php',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->json($printer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,11 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use App\Repository\PrinterRepository;
|
use App\Repository\PrinterRepository;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use JsonSerializable;
|
||||||
|
use PHPUnit\Util\Json;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: PrinterRepository::class)]
|
#[ORM\Entity(repositoryClass: PrinterRepository::class)]
|
||||||
class Printer
|
class Printer implements JsonSerializable
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
@ -77,4 +79,15 @@ class Printer
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'name' => $this->name,
|
||||||
|
'price' => $this->price,
|
||||||
|
'build_volume' => $this->buildVolume,
|
||||||
|
'max_speed' => $this->maxSpeed
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
14
symfony.lock
14
symfony.lock
@ -26,6 +26,20 @@
|
|||||||
"migrations/.gitignore"
|
"migrations/.gitignore"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"phpunit/phpunit": {
|
||||||
|
"version": "10.5",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes",
|
||||||
|
"branch": "main",
|
||||||
|
"version": "9.6",
|
||||||
|
"ref": "7364a21d87e658eb363c5020c072ecfdc12e2326"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
".env.test",
|
||||||
|
"phpunit.xml.dist",
|
||||||
|
"tests/bootstrap.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
"symfony/console": {
|
"symfony/console": {
|
||||||
"version": "7.0",
|
"version": "7.0",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
18
tests/Service/PrinterServiceTest.php
Normal file
18
tests/Service/PrinterServiceTest.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tests\Service;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
|
use PrinterService;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Bundle\MakerBundle\Docker\DockerDatabaseServices;
|
||||||
|
|
||||||
|
class PrinterServiceTest extends TestCase
|
||||||
|
{
|
||||||
|
#[Test]
|
||||||
|
public function EditPrinterShouldEditPrinter(){
|
||||||
|
$printerService = new PrinterService();
|
||||||
|
|
||||||
|
$printerService->editPrinter(Printer $printer, )
|
||||||
|
}
|
||||||
|
}
|
11
tests/bootstrap.php
Normal file
11
tests/bootstrap.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
|
require dirname(__DIR__).'/vendor/autoload.php';
|
||||||
|
|
||||||
|
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
|
||||||
|
require dirname(__DIR__).'/config/bootstrap.php';
|
||||||
|
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user