diff --git a/tests/Pest.php b/tests/Pest.php index 1f71b46a..53292075 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -16,4 +16,6 @@ $flextype_loader = require_once $flextype_autoload; filesystem()->directory(PATH['tmp'])->exists() and filesystem()->directory(PATH['tmp'])->delete(); -include ROOT_DIR . '/src/flextype/flextype.php'; +filesystem()->file(ROOT_DIR . '/tests/fixtures/settings.yaml')->copy(ROOT_DIR . '/project/config/flextype/settings.yaml'); + +include ROOT_DIR . '/src/flextype/flextype.php'; \ No newline at end of file diff --git a/tests/fixtures/settings.yaml b/tests/fixtures/settings.yaml index bf0eedf1..66b23fc9 100644 --- a/tests/fixtures/settings.yaml +++ b/tests/fixtures/settings.yaml @@ -13,28 +13,33 @@ charset: UTF-8 # The locale that'll be used by the Flextype. # -# Available locales to use: flextype/config/locales.yaml +# Available locales to use: src/flextype/config/locales.yaml locale: en_US -# Application URL +# Application Base url # -# Define custom application url -url: '/flextype' +# Define application base url +base_url: '' + +# Application Base Path +# +# Define application base path if application located in subdirectory +base_path: '/flextype' # Valid date format # -# - date_format: Valid date format -# -# - date_display_format: Valid date format to display -# # Date format variants: # -# d-m-Y H:i" - 02-02-2020 09:41 -# Y-m-d H:i" - 2020-02-02 09:41 -# m/d/Y h:i a - 02/02/2020 09:41 pm -# H:i d-m-Y - 09:41 02-02-2020 -# h:i a m/d/Y - 09:41 pm 02/02/2020 +# d-m-Y H:i" - 02-02-2020 09:41 +# Y-m-d H:i" - 2020-02-02 09:41 +# m/d/Y h:i a - 02/02/2020 09:41 pm +# H:i d-m-Y - 09:41 02-02-2020 +# h:i a m/d/Y - 09:41 pm 02/02/2020 + +# Valid date format date_format: 'd-m-Y H:i' + +# Valid date format to display date_display_format: 'd-m-Y H:i' # Display errors @@ -48,108 +53,24 @@ date_display_format: 'd-m-Y H:i' # - Detailed error messages for login failures could leak information to attackers # # In a production environment, always log errors to your PHP error logs. -# -# - display: Display errors or not. errors: + + # Set true to display errors. display: true + # Editor (emacs, idea, macvim, phpstorm, sublime, textmate, xdebug, vscode, atom, espresso) + editor: atom + + # Error page title + page_title: Error! + + # Handler (pretty, plain, json, xml) + handler: pretty + # Entries entries: + directory: '/entries' collections: - blog: - filename: blog - pattern: blog - extension: yaml - serializer: yaml - fields: - id: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/IdField.php" - registry: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/RegistryField.php" - entries: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/EntriesField.php" - fetch: - result: toObject - slug: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/SlugField.php" - published_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/PublishedAtField.php" - published_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/PublishedByField.php" - modified_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php" - created_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedAtField.php" - created_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedByField.php" - routable: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/RoutableField.php" - parsers: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ParsersField.php" - visibility: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/VisibilityField.php" - uuid: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/UuidField.php" - blog_posts: - pattern: blog/([a-zA-Z0-9_-]+) - filename: post - extension: md - serializer: frontmatter - fields: - registry: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/RegistryField.php" - entries: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/EntriesField.php" - fetch: - result: toObject - slug: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/SlugField.php" - published_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/PublishedAtField.php" - published_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/PublishedByField.php" - modified_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php" - created_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedAtField.php" - created_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedByField.php" - routable: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/RoutableField.php" - parsers: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ParsersField.php" - visibility: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/VisibilityField.php" - uuid: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/UuidField.php" - id: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/IdField.php" default: filename: entry extension: yaml @@ -247,48 +168,6 @@ entries: state: enabled: true path: "/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php" - media: - pattern: media - filename: media - extension: yaml - serializer: yaml - fields: - modified_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php" - created_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedAtField.php" - created_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedByField.php" - uuid: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/UuidField.php" - id: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/IdField.php" - media_item: - pattern: media/([a-zA-Z0-9_-]+) - filename: media - extension: yaml - serializer: yaml - fields: - modified_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php" - created_at: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedAtField.php" - created_by: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/CreatedByField.php" - uuid: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/UuidField.php" - id: - enabled: true - path: "/src/flextype/core/Entries/Fields/Default/IdField.php" # Cache @@ -332,7 +211,6 @@ entries: # - drivers.files.prevent_cache_slams: This option will allow you to prevent cache slams when making use of heavy cache items. # # - drivers.files.cache_slams_timeout: This option defines the cache slams timeout in seconds. - cache: enabled: false router: routes @@ -460,22 +338,8 @@ cache: zenddisk: {} zendshm: {} -# Whoops -# -# Error handler framework for PHP. -# -# - editor: emacs, idea, macvim, phpstorm, sublime, textmate, xdebug, vscode, atom, espresso -# -# - page_title: page title -whoops: - editor: atom - page_title: Error! - # Slim # -# - display_error_details: When true, additional information about exceptions are -# displayed by the default error handler. -# # - add_content_length_header: When true, Slim will add a Content-Length header to # the response. If you are using a runtime analytics tool, # such as New Relic, then this should be disabled. @@ -494,42 +358,45 @@ whoops: # If 'append' or 'prepend', then any echo or print statements # are captured and are either appended or prepended to the Response # returned from the route callable. -display_error_details: true add_content_length_header: true router_cache_file: false determine_route_before_app_middleware: false output_buffering: append +cli: false +web: false # Slugify -# -# - separator: By default Slugify will use dashes as separators. -# If you want to use a different default separator, -# you can set the separator option. -# -# - lowercase: By default Slugify will convert the slug to lowercase. -# If you want to preserve the case of the string you can set the -# lowercase option to false. -# -# - trim: By default Slugify will remove leading and trailing separators before -# returning the slug. If you do not want the slug to be trimmed you can -# set the trim option to false. -# -# - regexp: You can also change the regular expression that is used to replace -# characters with the separator. -# -# - lowercase_after_regexp: Lowercasing is done before using the regular expression. -# If you want to keep the lowercasing behavior but your -# regular expression needs to match uppercase letters, -# you can set the lowercase_after_regexp option to true. -# -# - strip_tags: Adds in an option to go through strip_tags() in case the string contains HTML etc. slugify: + + # Set true to enable slugify. enabled: true + + # By default Slugify will use dashes as separators. + # If you want to use a different default separator, + # you can set the separator option. separator: "-" + + # By default Slugify will convert the slug to lowercase. + # If you want to preserve the case of the string you can set the + # lowercase option to false. lowercase: true + + # By default Slugify will remove leading and trailing separators before + # returning the slug. If you do not want the slug to be trimmed you can + # set the trim option to false. trim: true + + # You can also change the regular expression that is used to replace + # characters with the separator. regexp: "/[^A-Za-z0-9]+/" + + # Lowercasing is done before using the regular expression. + # If you want to keep the lowercasing behavior but your + # regular expression needs to match uppercase letters, + # you can set the lowercase_after_regexp option to true. lowercase_after_regexp: false + + # Adds in an option to go through strip_tags() in case the string contains HTML etc. strip_tags: false # Serializers @@ -554,6 +421,10 @@ slugify: # # neon.decode.cache: Cache result data or no. Default is true. # neon.encode.flags: The flag can be 1, which will create multiline output. +# +# phparray.decode.cache: Cache result data or no. Default is true. +# +# phpcode.decode.cache: Cache result data or no. Default is true. serializers: json: decode: @@ -570,7 +441,7 @@ serializers: native: true flags: 0 encode: - inline: 5 + inline: 10 indent: 2 flags: 0 frontmatter: @@ -597,19 +468,31 @@ serializers: # Parsers # -# markdown.cache: Cache result data or no. Default is true. -# markdown.commonmark.renderer.block_separator: String to use for separating renderer block elements. -# markdown.commonmark.renderer.inner_separator: String to use for separating inner block contents. -# markdown.commonmark.renderer.soft_break: String to use for rendering soft breaks. -# markdown.commonmark.commonmark.enable_em: Disable parsing by setting to false; enable with true (default: true) -# markdown.commonmark.commonmark.enable_strong: Disable parsing by setting to false; enable with true (default: true) -# markdown.commonmark.commonmark.use_asterisk: Disable parsing of * for emphasis by setting to false; enable with true (default: true) -# markdown.commonmark.commonmark.use_underscore: Disable parsing of _ for emphasis by setting to false; enable with true (default: true) -# markdown.commonmark.commonmark.unordered_list_markers: Array of characters that can be used to indicate a bulleted list. -# markdown.commonmark.html_input: `strip` all HTML (equivalent to 'safe' => true). `allow` all HTML input as-is (default value; equivalent to `‘safe’ => false) `escape` Escape all HTML. -# markdown.commonmark.allow_unsafe_links: Remove risky link and image URLs by setting this to false (default: true). -# markdown.commonmark.max_nesting_level: The maximum nesting level for blocks (default: PHP_INT_MAX). Setting this to a positive integer can help protect against long parse times and/or segfaults if blocks are too deeply-nested. -# markdown.commonmark.slug_normalizer.max_length: Limits the size of generated slugs (defaults to 255 characters) +# - markdown.cache: Cache result data or no. Default is true. +# +# - markdown.commonmark.renderer.block_separator: String to use for separating renderer block elements. +# +# - markdown.commonmark.renderer.inner_separator: String to use for separating inner block contents. +# +# - markdown.commonmark.renderer.soft_break: String to use for rendering soft breaks. +# +# - markdown.commonmark.commonmark.enable_em: Disable parsing by setting to false; enable with true (default: true) +# +# - markdown.commonmark.commonmark.enable_strong: Disable parsing by setting to false; enable with true (default: true) +# +# - markdown.commonmark.commonmark.use_asterisk: Disable parsing of * for emphasis by setting to false; enable with true (default: true) +# +# - markdown.commonmark.commonmark.use_underscore: Disable parsing of _ for emphasis by setting to false; enable with true (default: true) +# +# - markdown.commonmark.commonmark.unordered_list_markers: Array of characters that can be used to indicate a bulleted list. +# +# - markdown.commonmark.html_input: `strip` all HTML (equivalent to 'safe' => true). `allow` all HTML input as-is (default value; equivalent to `‘safe’ => false) `escape` Escape all HTML. +# +# - markdown.commonmark.allow_unsafe_links: Remove risky link and image URLs by setting this to false (default: true). +# +# - markdown.commonmark.max_nesting_level: The maximum nesting level for blocks (default: PHP_INT_MAX). Setting this to a positive integer can help protect against long parse times and/or segfaults if blocks are too deeply-nested. +# +# - markdown.commonmark.slug_normalizer.max_length: Limits the size of generated slugs (defaults to 255 characters) parsers: markdown: cache: true @@ -632,9 +515,6 @@ parsers: shortcodes: cache: true shortcodes: - media: - enabled: true - path: "/src/flextype/core/Parsers/Shortcodes/MediaShortcode.php" entries: enabled: true path: "/src/flextype/core/Parsers/Shortcodes/EntriesShortcode.php" @@ -653,105 +533,125 @@ parsers: # CORS (Cross-origin resource sharing) allows JavaScript web apps to make HTTP requests to other domains. # This is important for third party web apps using Flextype, as without CORS, a JavaScript app hosted on example.com # couldn't access our APIs because they're hosted on another.com which is a different domain. -# -# - enabled: Set to true to enable cors -# -# - origin: The Access-Control-Allow-Origin response header indicates whether -# the response can be shared with requesting code from the given origin. -# read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin -# -# - headers: The Access-Control-Allow-Headers response header is used in response -# to a preflight request which includes the Access-Control-Request-Headers -# to indicate which HTTP headers can be used during the actual request. -# read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers -# -# - methods: The Access-Control-Allow-Methods response header specifies the method -# or methods allowed when accessing the resource in response to a preflight request. -# read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods -# -# - expose: The Access-Control-Expose-Headers response header indicates which headers -# can be exposed as part of the response by listing their names. -# read more: https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Access-Control-Expose-Headers -# -# - credentials: The Access-Control-Allow-Credentials response header tells browsers whether -# to expose the response to frontend JavaScript code when the request's credentials -# mode (Request.credentials) is include. -# read more: https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials cors: + + # Set to true to enable cors enabled: true + + # The Access-Control-Allow-Origin response header indicates whether + # the response can be shared with requesting code from the given origin. + # + # read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin origin: "*" + + # The Access-Control-Allow-Headers response header is used in response + # to a preflight request which includes the Access-Control-Request-Headers + # to indicate which HTTP headers can be used during the actual request. + # + # read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers headers: ["X-Requested-With", "Content-Type", "Accept", "Origin", "Authorization"] + + # The Access-Control-Allow-Methods response header specifies the method + # or methods allowed when accessing the resource in response to a preflight request. + # + # read more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods methods: [GET, POST, PUT, DELETE, PATCH, OPTIONS] + + # The Access-Control-Expose-Headers response header indicates which headers + # can be exposed as part of the response by listing their names. + # + # read more: https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Access-Control-Expose-Headers expose: [] + + # The Access-Control-Allow-Credentials response header tells browsers whether + # to expose the response to frontend JavaScript code when the request's credentials + # mode (Request.credentials) is include. + # + # read more: https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials credentials: false -# Media -# -# - upload.directory: Uploads directory -# -# - upload.overwrite: Overwrite existing files. -# -# - upload.autoconfirm: Auto-confirm uploads. -# -# - upload.prefix: Prefixing uploads. -# -# - upload.validation.allowed_file_extensions: Allowed file extensions. -# -# - upload.validation.max_file_size: Maximum file size. -# -# - upload.validation.image.width.max: Image maxiumum width. -# -# - upload.validation.image.width.min: Image minimum width. -# -# - upload.validation.image.height.max: Image maxiumum height. -# -# - upload.validation.image.height.min: Image minimum height. -# -# - upload.validation.image.ratio.size: The option can be a number (eg: 1.3) or a ratio-like string (eg: 4:3, 16:9). -# -# - upload.validation.image.ratio.error_margin: The option error_margin specifies how much the image is allowed to -# deviate from the target ratio. Default value is 0. -# -# - upload.process.image.quality: -media: - upload: - directory: '/uploads/media' - overwrite: true - autoconfirm: false - prefix: '' - validation: - allowed_file_extensions: ['gif', 'jpg', 'jpeg', 'png', 'ico', 'webm', 'svg'] - max_file_size: '24M' - image: - width: - max: 4920 - min: 100 - height: - max: 3264 - min: 100 - process: - image: - quality: 70 +# Upload +upload: + # Uploads directory + directory: '/uploads' + + # Overwrite existing files. + overwrite: true + + # Auto-confirm uploads. + autoconfirm: false + + # Prefixing uploads. + prefix: '' + + # Validation options + validation: + + # Allowed file extensions. + allowed_file_extensions: ['gif', 'jpg', 'jpeg', 'png', 'ico', 'webm', 'svg'] + + # Maximum file size. + max_file_size: '24M' + + # Image validation options + image: + + # Image maxiumum and minimum width + width: + max: 4920 + min: 100 + + # Image maxiumum and minimum height + height: + max: 3264 + min: 100 + + # Image ratio + #ratio: + # The option can be a number (eg: 1.3) or a ratio-like string (eg: 4:3, 16:9). + # size: 1.3 + + # The option error_margin specifies how much the image is allowed to + # deviate from the target ratio. Default value is 0. + # error_margin: 0 + + # Process uploaded files + process: + + # Images process settings + image: + + # Image quality + quality: 70 + # Session # # Set session options before you start the session # Standard PHP session configuration options # https://secure.php.net/manual/en/session.configuration.php session: + + # Session name name: Flextype # Flextype Rest APIs api: - content: - enabled: true - media: + + # Entries API + entries: + + # Set to true to enable Entries API enabled: true + + # Registry API registry: + + # Set to true to enable Registry API enabled: true - images: - enabled: true - tokens: - enabled: true + + # Utils API utils: + + # Set to true to enable Utils API enabled: true \ No newline at end of file