diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000000..e8c068d6bc5 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,41 @@ +build: false +version: dev-{build} +clone_folder: C:\projects\yii2 + +environment: + matrix: + - php_ver: 7.4.0 + +cache: + - '%APPDATA%\Composer' + - '%LOCALAPPDATA%\Composer' + - C:\tools\php -> .appveyor.yml + - C:\tools\composer.phar -> .appveyor.yml + +init: + - SET PATH=C:\tools\php;%PATH% + +install: + - ps: Set-Service wuauserv -StartupType Manual + - IF NOT EXIST C:\tools\php (choco install --yes --allow-empty-checksums php --version %php_ver% --params '/InstallDir:C:\tools\php') + - cd C:\tools\php + - copy php.ini-production php.ini + - echo date.timezone="UTC" >> php.ini + - echo memory_limit=512M >> php.ini + - echo extension_dir=ext >> php.ini + - echo extension=php_curl.dll >> php.ini + - echo extension=php_fileinfo.dll >> php.ini + - echo extension=php_gd2.dll >> php.ini + - echo extension=php_intl.dll >> php.ini + - echo extension=php_mbstring.dll >> php.ini + - echo extension=php_openssl.dll >> php.ini + - echo extension=php_pdo_sqlite.dll >> php.ini + - IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/2.6.3/composer.phar) + +before_test: + - cd C:\projects\yii2 + - php C:\tools\composer.phar update --no-interaction --no-progress --prefer-stable --no-ansi + +test_script: + - cd C:\projects\yii2 + - vendor\bin\phpunit --exclude-group mssql,mysql,pgsql,sqlite,db,oci,wincache,cubrid diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..5c156024dfa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +vendor +docs \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..5e9a93ea50d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..5b50d8e96bc --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,24 @@ +# Reformat code to be PSR-2 compatible +b5f8a4dc22d5f8188405a2099d85fc154226c9b2 +# Added php-cs-fixer coding standards validation to Travis CI +ba0ab403b52124c941dbeb46fbd9efdc12252a5d +# Coding style fixes +9d327baa8b2c80b53d4d405678f03e6b89ff6e38 +# Add visibility for all class elements +c82da8dc829d557e82b12edbed9e37003dfcc9a3 +# Fix codestyle in build and tests +909396074eef92d62dd34b4709bb7351e722bec3 +# Add void return to method in tests +d71f7309aeec1ac0fef223840cb65bbbf96f1f99 +# Use `::class` instead of `::className()` in tests +c960f93dfeefe760eb44bcdfa4463dcc7b29cc43 +# Replace deprecated PHPUnit mock builder `setMethods()` usage with `createPartialMock()`, `onlyMethods()` and `addMethods()` methods +80545100b3f40423118b5cd413fcdb9c7dd7fa5e +# Make test data providers static and declare array return types +da20adc82aef3eb5ae0bad3889fe6695e6424f06 +# Fix codestyle in `tests` +2f8e62d6b64324099b44cbac69395fef0e53b13e +# Short array syntax +1f6a8230732d829cdf2f3ca6755e4ac32f2c6f4f +# CS fixes. +7a7d2a9c06c099de8064729ca3fc95fb24241b75 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..87563215ea3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,37 @@ +# Autodetect text files +* text=auto eol=lf + +# ...Unless the name matches the following overriding patterns + +# Definitively text files +*.php text +*.css text +*.js text +*.txt text +*.md text +*.xml text +*.json text +*.bat text +*.sql text +*.yml text + +# Ensure those won't be messed up with +*.png binary +*.jpg binary +*.gif binary +*.ttf binary + +# Ignore some meta files when creating an archive of this repository +# We do not ignore any content, because this repo represents the +# `yiisoft/yii2-dev` package, which is expected to ship all tests and docs. +/.appveyor.yml export-ignore +/.github export-ignore +/.editorconfig export-ignore +/.git-blame-ignore-revs export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore + +# Avoid merge conflicts in CHANGELOG +# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/ +/framework/CHANGELOG.md merge=union + diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000000..bdf7df026de --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,7 @@ +Contributing to Yii 2 +===================== + +- [Report an issue](../docs/internals/report-an-issue.md) +- [Translate documentation or messages](../docs/internals/translation-workflow.md) +- [Give us feedback or start a design discussion](https://www.yiiframework.com/forum/index.php/forum/42-general-discussions-for-yii-20/) +- [Contribute to the core code or fix bugs](../docs/internals/git-workflow.md) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..d6f1e3b4a1b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,5 @@ +# These are supported funding model platforms + +open_collective: yiisoft +github: [yiisoft] +tidelift: "packagist/yiisoft/yii2" diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..9dfde405a63 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,19 @@ + + +### What steps will reproduce the problem? + +### What is the expected result? + +### What do you get instead? + + +### Additional info + +| Q | A +| ---------------- | --- +| Yii version | 2.0.? +| PHP version | +| Operating system | diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..cecccf6dcf1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,6 @@ +| Q | A +| ------------- | --- +| Is bugfix? | ✔️/❌ +| New feature? | ✔️/❌ +| Breaks BC? | ✔️/❌ +| Fixed issues | diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000000..405acca4e76 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,6 @@ +# Security Policy + +Please use the [security issue form](https://www.yiiframework.com/security) to report to us any security issue you find in Yii. +DO NOT use the issue tracker or discuss it in the public forum as it will cause more damage than help. + +Please note that as a non-commercial OpenSource project we are not able to pay bounties at the moment. diff --git a/.github/actions/php-setup/action.yml b/.github/actions/php-setup/action.yml new file mode 100644 index 00000000000..c31c7646d03 --- /dev/null +++ b/.github/actions/php-setup/action.yml @@ -0,0 +1,83 @@ +--- +name: PHP setup with composer. +description: Setup PHP environment with composer and install dependencies. + +inputs: + composer-command: + description: Composer command (install or update) to run. + default: update + required: false + type: string + composer-flags: + description: Additional composer flags + default: >- + --prefer-dist + --no-interaction + --no-progress + --optimize-autoloader + --ansi + required: false + type: string + composer-version: + description: Composer version to use. + default: + required: false + type: string + coverage-driver: + description: Code coverage driver to use (pcov, xdebug). + default: none + required: false + type: string + extensions: + description: List of extensions to PHP. + default: + required: false + type: string + ignore-platform-reqs: + description: Whether to add --ignore-platform-reqs to composer command. + default: false + required: false + type: boolean + ini-values: + description: Initial values for PHP configuration. + default: date.timezone='UTC' + required: false + type: string + php-version: + description: PHP versions as a JSON array string '["8.4"]'. + default: '["7.4","8.0","8.1","8.2","8.3","8.4"]' + required: false + type: string + tools: + description: Tools to test, separated by comma. + default: pie + required: false + type: string + +runs: + using: composite + steps: + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + coverage: ${{ inputs.coverage-driver }} + extensions: ${{ inputs.extensions }} + ini-values: ${{ inputs.ini-values }} + php-version: ${{ inputs.php-version }} + tools: ${{ inputs.tools }} + + - name: Update composer. + shell: bash + run: composer self-update ${{ inputs.composer-version }} + + - name: Install dependencies with composer. + shell: bash + run: >- + composer + ${{ inputs.composer-command }} + ${{ inputs.composer-flags }} + ${{ + inputs.ignore-platform-reqs == 'true' + && '--ignore-platform-reqs' + || '' + }} diff --git a/.github/actions/phpunit/action.yml b/.github/actions/phpunit/action.yml new file mode 100644 index 00000000000..6d4b24e7823 --- /dev/null +++ b/.github/actions/phpunit/action.yml @@ -0,0 +1,129 @@ +--- +name: PHPUnit Test Runner. +description: Run PHPUnit tests with coverage and configurable options. + +inputs: + additional-args: + description: Additional PHPUnit arguments. + default: "--log-junit junit.xml --verbose" + required: false + type: string + configuration: + description: PHPUnit configuration file. + default: "" + required: false + type: string + coverage-driver: + description: Code coverage driver to use (pcov, xdebug, none). + default: none + required: false + type: string + coverage-file: + description: Coverage output file name. + default: coverage.xml + required: false + type: string + coverage-format: + description: Coverage report format (clover, html, xml). + default: clover + required: false + type: string + coverage-token: + description: Codecov token for uploading coverage. + default: "" + required: false + type: string + debug: + description: Display warnings in phpunit. + default: "" + required: false + type: string + exclude-group: + description: Exclude group from phpunit. + default: "" + required: false + type: string + group: + description: Include specific group in phpunit. + default: "" + required: false + type: string + path: + description: Path to PHPUnit executable. + default: vendor/bin/phpunit + required: false + type: string + test-suite: + description: Specific test suite to run. + default: "" + required: false + type: string + +runs: + using: composite + steps: + - name: Build PHPUnit command. + id: build-cmd + shell: bash + run: | + PATH_INPUT="${{ inputs.path }}" + CONFIG_INPUT="${{ inputs.configuration }}" + SUITE_INPUT="${{ inputs.test-suite }}" + GROUP_INPUT="${{ inputs.group }}" + EXCLUDE_GROUP_INPUT="${{ inputs.exclude-group }}" + DEBUG_INPUT="${{ inputs.debug }}" + ADDITIONAL_ARGS="${{ inputs.additional-args }}" + COVERAGE_DRIVER="${{ inputs.coverage-driver }}" + COVERAGE_FORMAT="${{ inputs.coverage-format }}" + COVERAGE_FILE="${{ inputs.coverage-file }}" + + PHPUNIT_CMD="$PATH_INPUT --colors=always" + + add_param() { + if [ -n "$2" ]; then + PHPUNIT_CMD="$PHPUNIT_CMD $1 $2" + fi + } + + if [ -n "$COVERAGE_DRIVER" ] && [ "$COVERAGE_DRIVER" != "none" ]; then + PHPUNIT_CMD="$PHPUNIT_CMD --coverage-$COVERAGE_FORMAT=$COVERAGE_FILE" + fi + + add_param "--configuration" "$CONFIG_INPUT" + add_param "--testsuite" "$SUITE_INPUT" + add_param "--group" "$GROUP_INPUT" + add_param "--exclude-group" "$EXCLUDE_GROUP_INPUT" + + if [ -n "$DEBUG_INPUT" ]; then + PHPUNIT_CMD="$PHPUNIT_CMD $DEBUG_INPUT" + fi + + if [ -n "$ADDITIONAL_ARGS" ]; then + PHPUNIT_CMD="$PHPUNIT_CMD $ADDITIONAL_ARGS" + fi + + echo "command=$PHPUNIT_CMD" >> $GITHUB_OUTPUT + echo "PHPUnit command: $PHPUNIT_CMD" + + - name: Run PHPUnit tests on Linux. + shell: bash + if: runner.os != 'Windows' + run: ${{ steps.build-cmd.outputs.command }} + + - name: Run PHPUnit tests on Windows. + shell: pwsh + if: runner.os == 'Windows' + run: Invoke-Expression "${{ steps.build-cmd.outputs.command }}" + + - name: Upload test results to Codecov. + if: ${{ !cancelled() && inputs.coverage-driver != 'none' }} + uses: codecov/test-results-action@v1 + with: + token: ${{ inputs.coverage-token }} + + - name: Upload coverage to Codecov. + if: ${{ !cancelled() && inputs.coverage-driver != 'none' }} + uses: codecov/codecov-action@v5 + with: + files: ./${{ inputs.coverage-file }} + token: ${{ inputs.coverage-token }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..bca6aa771a8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,113 @@ +--- +name: build + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, dom, imagick, intl, mbstring, mcrypt, memcached + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_EXCLUDE_GROUP: db,wincache + XDEBUG_MODE: coverage + +jobs: + phpunit: + name: PHP ${{ matrix.php }} + + env: + COVERAGE_DRIVER: ${{ matrix.php < 8.1 && 'xdebug' || 'pcov' }} + IGNORE_PLATFORM_REQS: false + + runs-on: ubuntu-latest + + services: &memcached-service + memcached: + image: memcached:latest + ports: + - 11211:11211 + options: >- + --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/11211'" + --health-interval 10s + --health-retries 5 + --health-timeout 5s + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + + steps: &build-steps + - name: Checkout. + uses: actions/checkout@v5 + + - name: Generate french locale. + run: sudo locale-gen fr_FR.UTF-8 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ignore-platform-reqs: ${{ env.IGNORE_PLATFORM_REQS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + exclude-group: ${{ env.PHPUNIT_EXCLUDE_GROUP }} + + phpunit-dev: + name: PHP ${{ matrix.php }} + + env: + COVERAGE_DRIVER: none + IGNORE_PLATFORM_REQS: true + + runs-on: ubuntu-latest + + services: *memcached-service + + strategy: + fail-fast: false + matrix: + php: [8.6] + + steps: *build-steps diff --git a/.github/workflows/ci-mariadb.yml b/.github/workflows/ci-mariadb.yml new file mode 100644 index 00000000000..eb3f6cf2ba2 --- /dev/null +++ b/.github/workflows/ci-mariadb.yml @@ -0,0 +1,121 @@ +--- +name: ci-mariadb + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, intl, pdo, pdo_mysql + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: mysql + XDEBUG_MODE: coverage + +jobs: + tests: + name: PHP ${{ matrix.php }}-${{ matrix.mariadb }} + + env: + COVERAGE_DRIVER: xdebug + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.5] + mariadb: + - mariadb:10.4 + - mariadb:latest + + services: &mariadb-service + mysql: + image: ${{ matrix.mariadb }} + env: + MARIADB_ROOT_PASSWORD: root + MARIADB_DATABASE: yiitest + ports: + - 3306:3306 + options: >- + --name=mariadb + --health-cmd="mariadb-admin ping" + --health-interval=10s + --health-retries=3 + --health-timeout=5s + --mount type=tmpfs,destination=/var/lib/mysql + + steps: &mariadb-steps + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} + + tests-dev: + name: PHP ${{ matrix.php }}-${{ matrix.mariadb }} + + env: + COVERAGE_DRIVER: none + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1, 8.2, 8.3, 8.4] + mariadb: + - mariadb:latest + + services: *mariadb-service + + steps: *mariadb-steps diff --git a/.github/workflows/ci-mssql.yml b/.github/workflows/ci-mssql.yml new file mode 100644 index 00000000000..3cc99944df0 --- /dev/null +++ b/.github/workflows/ci-mssql.yml @@ -0,0 +1,127 @@ +--- +name: ci-mssql + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, intl, pdo, pdo_sqlsrv + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: mssql + XDEBUG_MODE: coverage + +jobs: + tests: + name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} + + env: + COVERAGE_DRIVER: xdebug + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.5] + mssql: + - server:2019-latest + - server:2022-latest + + services: &mssql-service + mssql: + image: mcr.microsoft.com/mssql/${{ matrix.mssql }} + env: + SA_PASSWORD: YourStrong!Passw0rd + ACCEPT_EULA: Y + MSSQL_PID: Developer + ports: + - 1433:1433 + options: >- + --name=mssql + --health-cmd="/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" + --health-interval=10s + --health-retries=3 + --health-timeout=5s + + steps: &mssql-steps + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Install ODBC driver. + run: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 + + - name: Create MS SQL Database. + run: docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest' + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} + + tests-dev: + name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} + + env: + COVERAGE_DRIVER: none + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1, 8.2, 8.3, 8.4] + mssql: + - server:2022-latest + + services: *mssql-service + + steps: *mssql-steps diff --git a/.github/workflows/ci-mysql.yml b/.github/workflows/ci-mysql.yml new file mode 100644 index 00000000000..ac595b54a2a --- /dev/null +++ b/.github/workflows/ci-mysql.yml @@ -0,0 +1,119 @@ +--- +name: ci-mysql + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, intl, pdo, pdo_mysql + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: mysql + XDEBUG_MODE: coverage + +jobs: + tests: + name: PHP ${{ matrix.php }}-mysql-${{ matrix.mysql }} + + env: + COVERAGE_DRIVER: xdebug + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.5] + mysql: [5.7, latest] + + services: &mysql-service + mysql: + image: mysql:${{ matrix.mysql }} + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: yiitest + ports: + - 3306:3306 + options: >- + --name=mysql + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-retries=3 + --health-timeout=5s + --mount type=tmpfs,destination=/var/lib/mysql + + steps: &mysql-steps + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} + + tests-dev: + name: PHP ${{ matrix.php }}-mysql-${{ matrix.mysql }} + + env: + COVERAGE_DRIVER: none + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1, 8.2, 8.3, 8.4] + mysql: + - latest + + services: *mysql-service + + steps: *mysql-steps diff --git a/.github/workflows/ci-node.yml b/.github/workflows/ci-node.yml new file mode 100644 index 00000000000..911d9ae5a4d --- /dev/null +++ b/.github/workflows/ci-node.yml @@ -0,0 +1,68 @@ +name: build-node + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +env: + DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: NPM 10 on ubuntu-latest + + runs-on: ubuntu-latest + + steps: + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Install dependencies. + run: composer update $DEFAULT_COMPOSER_FLAGS + + - name: Install JQuery `3.6.*@stable` for tests. + run: composer require "bower-asset/jquery:3.6.*@stable" + + - name: Install node.js. + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Tests. + run: | + npm install + npm run lint + npm test diff --git a/.github/workflows/ci-oracle.yml b/.github/workflows/ci-oracle.yml new file mode 100644 index 00000000000..c321fe4a712 --- /dev/null +++ b/.github/workflows/ci-oracle.yml @@ -0,0 +1,88 @@ +--- +name: ci-oracle + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: PHP ${{ matrix.php }}-oci + + env: + COVERAGE_DRIVER: ${{ matrix.php == 7.4 && 'xdebug' || 'none' }} + PHP_EXTENSIONS: curl, intl, oci8, pdo, pdo_oci + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: oci + XDEBUG_MODE: coverage + + runs-on: ubuntu-latest + + strategy: + matrix: + php: [7.4] + + services: + oci: + image: wnameless/oracle-xe-11g-r2:latest + ports: + - 1521:1521 + options: >- + --name=oci + + steps: + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} diff --git a/.github/workflows/ci-pgsql.yml b/.github/workflows/ci-pgsql.yml new file mode 100644 index 00000000000..5ff7d6dfc9b --- /dev/null +++ b/.github/workflows/ci-pgsql.yml @@ -0,0 +1,120 @@ +--- +name: ci-pgsql + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, intl, pdo, pdo_pgsql + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: pgsql + XDEBUG_MODE: coverage + +jobs: + tests: + name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }} + + env: + COVERAGE_DRIVER: xdebug + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.5] + pgsql: [10, 11, 12, 13, 14, 15, 16, 17] + + services: &pgsql-service + postgres: + image: postgres:${{ matrix.pgsql }} + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: yiitest + ports: + - 5432:5432 + options: >- + --name=postgres + --health-cmd="pg_isready" + --health-interval=10s + --health-retries=3 + --health-timeout=5s + --mount type=tmpfs,destination=/var/lib/postgresql/data + + steps: &pgsql-steps + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} + + tests-dev: + name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }} + + env: + COVERAGE_DRIVER: none + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1, 8.2, 8.3, 8.4] + pgsql: + - 17 + + services: *pgsql-service + + steps: *pgsql-steps diff --git a/.github/workflows/ci-sqlite.yml b/.github/workflows/ci-sqlite.yml new file mode 100644 index 00000000000..086a2ff0779 --- /dev/null +++ b/.github/workflows/ci-sqlite.yml @@ -0,0 +1,98 @@ +--- +name: ci-sqlite + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PHP_EXTENSIONS: curl, intl, pdo, pdo_sqlite + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + PHPUNIT_GROUP: sqlite + XDEBUG_MODE: coverage + +jobs: + tests: + name: PHP ${{ matrix.php }}-sqlite + + env: + COVERAGE_DRIVER: xdebug + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.5] + + steps: &sqlite-steps + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + + - name: Run PHPUnit tests. + uses: ./.github/actions/phpunit + with: + coverage-driver: ${{ env.COVERAGE_DRIVER }} + coverage-token: ${{ secrets.CODECOV_TOKEN }} + group: ${{ env.PHPUNIT_GROUP }} + + tests-dev: + name: PHP ${{ matrix.php }}-sqlite + + env: + COVERAGE_DRIVER: none + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1, 8.2, 8.3, 8.4] + + steps: *sqlite-steps diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000000..dd1861d3d3a --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,69 @@ +--- +name: lint + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + phpcs: + runs-on: ubuntu-latest + + name: PHP ${{ matrix.php }}-PHP_CodeSniffer + + strategy: + fail-fast: false + matrix: + php: [8.4] + + steps: + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + composer-command: install + php-version: ${{ matrix.php }} + tools: cs2pr + + - name: Run PHP_CodeSniffer. + run: vendor/bin/phpcs -q --report=checkstyle framework/ tests/ build/ | cs2pr diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 00000000000..e9b83acdc9f --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,79 @@ +--- +name: static analysis + +permissions: + contents: read + pull-requests: write + +on: + pull_request: &ignore-paths + paths-ignore: + - ".appveyor.yml" + - ".dockerignore" + - ".editorconfig" + - ".git-blame-ignore-revs" + - ".gitattributes" + - ".github/CONTRIBUTING.md" + - ".github/FUNDING.yml" + - ".github/ISSUE_TEMPLATE.md" + - ".github/PULL_REQUEST_TEMPLATE.md" + - ".github/SECURITY.md" + - ".gitignore" + - ".gitlab-ci.yml" + - "code-of-conduct.md" + - "docs/**" + - "framework/.gitignore" + - "framework/.phpstorm.meta.php" + - "framework/CHANGELOG.md" + - "framework/LICENSE.md" + - "framework/README.md" + - "framework/UPGRADE.md" + - "eslint.config.js" + - "LICENSE.md" + - "README.md" + - "ROADMAP.md" + + push: *ignore-paths + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + phpstan: + name: PHP ${{ matrix.php }}-PHPStan + + env: + PHP_EXTENSIONS: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, curl, dom, imagick, intl, mbstring, mcrypt, memcached + PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC' + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + + steps: + - name: Monitor action permissions. + if: runner.os != 'Windows' + uses: GitHubSecurityLab/actions-permissions/monitor@v1 + + - name: Checkout. + uses: actions/checkout@v5 + + - name: Setup PHP with Composer. + uses: ./.github/actions/php-setup + with: + extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }} + ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}" + php-version: ${{ matrix.php }} + tools: cs2pr, pie + + - name: Static analysis PHP 7.x. + if: matrix.php == '7.3' || matrix.php == '7.4' + run: vendor/bin/phpstan analyse --configuration=phpstan-7x.dist.neon --error-format=checkstyle | cs2pr + + - name: Static analysis PHP 8.x. + if: matrix.php != '7.3' && matrix.php != '7.4' + run: vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr diff --git a/.gitignore b/.gitignore index 13fcf4a1839..ed9306c2527 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # phpstorm project files .idea +*.iml # netbeans project files nbproject @@ -9,11 +10,45 @@ nbproject .project .settings +# sublime text project / workspace files +*.sublime-project +*.sublime-workspace + +# visual studio code project files +.vscode + # windows thumbnail cache Thumbs.db # composer vendor dir -/yii/vendor +/vendor +# cubrid install dir +/cubrid # composer itself is not needed composer.phar + +# composer.lock in applications is ignored since it's automatically created by composer when application is installed +/apps/*/composer.lock + +# Mac DS_Store Files +.DS_Store + +# phpunit itself is not needed +phpunit.phar +# local phpunit config +/phpunit.xml +.phpunit.result.cache + +# ignore dev installed apps and extensions +/apps +/extensions +/packages + +# NPM packages +/node_modules +.env +package-lock.json + +# local phpstan config +phpstan.neon diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000000..d7797e87128 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,113 @@ +image: docker:latest + +services: + - docker:dind + +variables: + DOCKER_YII2_PHP_IMAGE: yiisoftware/yii2-php:7.4-apache + DOCKER_MYSQL_IMAGE: percona:5.7 + DOCKER_POSTGRES_IMAGE: postgres:9.3 + +before_script: + - apk add --no-cache git curl docker-compose + - docker info + - cd tests + +stages: + - travis + - test + - cleanup + +test: + stage: test + script: + - docker-compose up --build -d + - docker-compose run --rm php vendor/bin/phpunit -v --exclude caching,db,data --log-junit tests/_junit/test.xml + +caching: + stage: test + only: + - tests/caching + - tests/full + script: + - export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml + - docker-compose up --build -d + - docker-compose run --rm php vendor/bin/phpunit -v --group caching --exclude db + +db: + stage: test + only: + - tests/mysql + - tests/full + script: + - docker-compose up --build -d + - docker-compose run --rm php vendor/bin/phpunit -v --group db --exclude caching,mysql,pgsql,mssql,cubrid,oci + + +mysql: + stage: test + only: + - tests/mysql + - tests/full + script: + - export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml + - docker-compose up --build -d + # wait for db (retry X times) + - docker-compose run --rm php bash -c "while ! curl mysql:3306; do ((c++)) && ((c==30)) && break; sleep 2; done" + - docker-compose run --rm php vendor/bin/phpunit -v --group mysql + + +pgsql: + stage: test + only: + - tests/pgsql + - tests/full + script: + - export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml + - docker-compose up --build -d + # wait for db (retry X times) + - docker-compose run --rm php bash -c 'while [ true ]; do curl postgres:5432; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==25)) && break; sleep 2; done' + - docker-compose run --rm php vendor/bin/phpunit -v --group pgsql + + +cubrid: + stage: test + only: + - tests/cubrid + - tests/extra + script: + - cd cubrid + - docker-compose up --build -d + # wait for db (retry X times) + - docker-compose run --rm php bash -c 'while [ true ]; do curl cubrid:1523; if [ $? == 56 ]; then break; fi; ((c++)) && ((c==20)) && break; sleep 3; done' + - sleep 5 + - docker-compose run --rm php /project/vendor/bin/phpunit -v --group cubrid + + +mssql: + stage: test + only: + - tests/mssql + - tests/extra + script: + - cd mssql + - docker-compose up --build -d + # wait for db (retry X times) + - docker-compose run --rm php bash -c 'while [ true ]; do curl mssql:1433; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==15)) && break; sleep 5; done' + - sleep 3 + # Note: Password has to be the last parameter + - docker-compose run --rm sqlcmd sh -c 'sqlcmd -S mssql -U sa -Q "CREATE DATABASE yii2test" -P Microsoft-12345' + - docker-compose run --rm php vendor/bin/phpunit -v --group mssql + + +travis: + stage: travis + only: + - travis + script: + - export COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml:docker-compose.pgsql.yml + - docker-compose up --build -d + # wait for dbs ... + - sleep 10 + - docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,cubrid,oci,wincache,cubrid + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e4b82780384..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - -env: - - DB=mysql - -before_script: - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS yiitest;'; fi" - -script: phpunit \ No newline at end of file diff --git a/.well-known/funding-manifest-urls b/.well-known/funding-manifest-urls new file mode 100644 index 00000000000..c323cd41260 --- /dev/null +++ b/.well-known/funding-manifest-urls @@ -0,0 +1 @@ +https://www.yiiframework.com/funding.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..4e779bdeba4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +ARG DOCKER_YII2_PHP_IMAGE +FROM ${DOCKER_YII2_PHP_IMAGE} + +# Project source-code +WORKDIR /project +ADD composer.* /project/ +# Install packages +RUN /usr/local/bin/composer install --prefer-dist +ADD ./ /project +ENV PATH /project/vendor/bin:${PATH} diff --git a/LICENSE.md b/LICENSE.md index 6edcc4f571a..bc5674fe470 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,4 @@ -The Yii framework is free software. It is released under the terms of -the following BSD License. - -Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) +Copyright © 2008 by Yii Software (https://www.yiiframework.com/) All rights reserved. Redistribution and use in source and binary forms, with or without @@ -14,7 +11,7 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Yii Software LLC nor the names of its + * Neither the name of Yii Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -29,4 +26,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 9bd64803a4f..2348867cc7c 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,115 @@ -Yii 2.0 Public Preview -====================== +
+
+
+
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus - commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
- Get started with Yii -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta - felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum - massa.
- - -Please fill out the following fields to login:
- - array('class' => 'form-horizontal'))); ?> - field($model, 'username')->textInput(); ?> - field($model, 'password')->passwordInput(); ?> - field($model, 'rememberMe')->checkbox(); ?> -- This is the About page. You may modify the following file to customize its content: -
- -
-
diff --git a/apps/advanced/frontend/views/site/contact.php b/apps/advanced/frontend/views/site/contact.php
deleted file mode 100644
index e740d0fd9aa..00000000000
--- a/apps/advanced/frontend/views/site/contact.php
+++ /dev/null
@@ -1,46 +0,0 @@
-title = 'Contact';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-- If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. -
- - array('class' => 'form-horizontal'), - 'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge')), -)); ?> - field($model, 'name')->textInput(); ?> - field($model, 'email')->textInput(); ?> - field($model, 'subject')->textInput(); ?> - field($model, 'body')->textArea(array('rows' => 6)); ?> - field($model, 'verifyCode'); - echo $field->begin() - . $field->label() - . Captcha::widget() - . Html::activeTextInput($model, 'verifyCode', array('class' => 'input-medium')) - . $field->error() - . $field->end(); - ?> -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus - commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
- Get started with Yii -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta - felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum - massa.
- - -Please fill out the following fields to login:
- - array('class' => 'form-horizontal'))); ?> - field($model, 'username')->textInput(); ?> - field($model, 'password')->passwordInput(); ?> - field($model, 'rememberMe')->checkbox(); ?> -The path to yii framework seems to be incorrect.
'; - echo 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) .'.
'; - echo 'Please refer to the README on how to install Yii.
'; -} - -require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); -$requirementsChecker = new YiiRequirementChecker(); - -/** - * Adjust requirements according to your application specifics. - */ -$requirements = array( - // Database : - array( - 'name' => 'PDO extension', - 'mandatory' => true, - 'condition' => extension_loaded('pdo'), - 'by' => 'All DB-related classes', - ), - array( - 'name' => 'PDO SQLite extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_sqlite'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for SQLite database.', - ), - array( - 'name' => 'PDO MySQL extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_mysql'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for MySQL database.', - ), - // Cache : - array( - 'name' => 'Memcache extension', - 'mandatory' => false, - 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), - 'by' => 'CMemCache', - 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached totrue.' : ''
- ),
- array(
- 'name' => 'APC extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('apc') || extension_loaded('apc'),
- 'by' => 'CApcCache',
- ),
- // Additional PHP extensions :
- array(
- 'name' => 'Mcrypt extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('mcrypt'),
- 'by' => 'CSecurityManager',
- 'memo' => 'Required by encrypt and decrypt methods.'
- ),
- // PHP ini :
- 'phpSafeMode' => array(
- 'name' => 'PHP safe mode',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
- 'by' => 'File uploading and console command execution',
- 'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
- 'name' => 'Expose PHP',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
- 'by' => 'Security reasons',
- 'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
- 'name' => 'PHP allow url include',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
- 'by' => 'Security reasons',
- 'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
- 'name' => 'PHP mail SMTP',
- 'mandatory' => false,
- 'condition' => strlen(ini_get('SMTP'))>0,
- 'by' => 'Email sending',
- 'memo' => 'PHP mail SMTP server required',
- ),
-);
-$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/advanced/vendor/.gitignore b/apps/advanced/vendor/.gitignore
deleted file mode 100644
index c96a04f008e..00000000000
--- a/apps/advanced/vendor/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/yii.bat b/apps/advanced/yii.bat
deleted file mode 100644
index 5e21e2e9908..00000000000
--- a/apps/advanced/yii.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem Yii command line bootstrap script for Windows.
-rem
-rem @author Qiang Xue The path to yii framework seems to be incorrect.
'; - echo 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) .'.
'; - echo 'Please refer to the README on how to install Yii.
'; -} - -require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); -$requirementsChecker = new YiiRequirementChecker(); - -/** - * Adjust requirements according to your application specifics. - */ -$requirements = array( - // Database : - array( - 'name' => 'PDO extension', - 'mandatory' => true, - 'condition' => extension_loaded('pdo'), - 'by' => 'All DB-related classes', - ), - array( - 'name' => 'PDO SQLite extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_sqlite'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for SQLite database.', - ), - array( - 'name' => 'PDO MySQL extension', - 'mandatory' => false, - 'condition' => extension_loaded('pdo_mysql'), - 'by' => 'All DB-related classes', - 'memo' => 'Required for MySQL database.', - ), - // Cache : - array( - 'name' => 'Memcache extension', - 'mandatory' => false, - 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), - 'by' => 'CMemCache', - 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached totrue.' : ''
- ),
- array(
- 'name' => 'APC extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('apc') || extension_loaded('apc'),
- 'by' => 'CApcCache',
- ),
- // Additional PHP extensions :
- array(
- 'name' => 'Mcrypt extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('mcrypt'),
- 'by' => 'CSecurityManager',
- 'memo' => 'Required by encrypt and decrypt methods.'
- ),
- // PHP ini :
- 'phpSafeMode' => array(
- 'name' => 'PHP safe mode',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
- 'by' => 'File uploading and console command execution',
- 'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
- 'name' => 'Expose PHP',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
- 'by' => 'Security reasons',
- 'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
- 'name' => 'PHP allow url include',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
- 'by' => 'Security reasons',
- 'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
- 'name' => 'PHP mail SMTP',
- 'mandatory' => false,
- 'condition' => strlen(ini_get('SMTP'))>0,
- 'by' => 'Email sending',
- 'memo' => 'PHP mail SMTP server required',
- ),
-);
-$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/basic/runtime/.gitignore b/apps/basic/runtime/.gitignore
deleted file mode 100644
index c96a04f008e..00000000000
--- a/apps/basic/runtime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/basic/vendor/.gitignore b/apps/basic/vendor/.gitignore
deleted file mode 100644
index c96a04f008e..00000000000
--- a/apps/basic/vendor/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/basic/views/layouts/main.php b/apps/basic/views/layouts/main.php
deleted file mode 100644
index 635e1181aff..00000000000
--- a/apps/basic/views/layouts/main.php
+++ /dev/null
@@ -1,66 +0,0 @@
-registerAssetBundle('app');
-?>
-beginPage(); ?>
-
-
-
-
- - This is the About page. You may modify the following file to customize its content: -
- -
-
diff --git a/apps/basic/views/site/contact.php b/apps/basic/views/site/contact.php
deleted file mode 100644
index e740d0fd9aa..00000000000
--- a/apps/basic/views/site/contact.php
+++ /dev/null
@@ -1,46 +0,0 @@
-title = 'Contact';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-- If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. -
- - array('class' => 'form-horizontal'), - 'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge')), -)); ?> - field($model, 'name')->textInput(); ?> - field($model, 'email')->textInput(); ?> - field($model, 'subject')->textInput(); ?> - field($model, 'body')->textArea(array('rows' => 6)); ?> - field($model, 'verifyCode'); - echo $field->begin() - . $field->label() - . Captcha::widget() - . Html::activeTextInput($model, 'verifyCode', array('class' => 'input-medium')) - . $field->error() - . $field->end(); - ?> -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus - commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
- Get started with Yii -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.
- - -Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta - felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum - massa.
- - -Please fill out the following fields to login:
- - array('class' => 'form-horizontal'))); ?> - field($model, 'username')->textInput(); ?> - field($model, 'password')->passwordInput(); ?> - field($model, 'rememberMe')->checkbox(); ?> -