Skip to content

Commit 340bc23

Browse files
authored
Merge pull request #1448 from phalcon/4.0.x
4.0.2
2 parents 837c1f5 + a02ea0f commit 340bc23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+921
-143
lines changed

.ci/github_set_env.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file is part of the Phalcon Framework.
4+
#
5+
# (c) Phalcon Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the
8+
# LICENSE.txt file that was distributed with this source code.
9+
10+
set -e
11+
12+
sed -i "s/MYSQL_DB_PORT=3306/MYSQL_DB_PORT=$MYSQL_DB_PORT/g" .env
13+
sed -i "s/MYSQL_DB_PASSWORD=''/MYSQL_DB_PASSWORD='$MYSQL_DB_PASSWORD'/g" .env
14+
sed -i "s/POSTGRES_DB_PORT=5432/POSTGRES_DB_PORT=$POSTGRES_DB_PORT/g" .env

.ci/link_devtools.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file is part of the Phalcon Framework.
4+
#
5+
# (c) Phalcon Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the
8+
# LICENSE.txt file that was distributed with this source code.
9+
10+
mkdir "$GITHUB_WORKSPACE"/bin
11+
ln -s "$GITHUB_WORKSPACE"/phalcon "$GITHUB_WORKSPACE"/bin/phalcon
12+
echo "::add-path::$GITHUB_WORKSPACE/bin"
13+
chmod +x "$GITHUB_WORKSPACE"/phalcon

.ci/serve-webtools.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
set -e
1111

12-
WEB_TOOLS_PROJECT=${HOME}/webtools
12+
#WEB_TOOLS_PROJECT=${HOME}/webtools
1313

14-
rm -rf ${WEB_TOOLS_PROJECT}
15-
phalcon project --directory=$HOME --name=webtools
16-
sed -i "s/'dbname' => 'test',/'dbname' => 'devtools',/g" ${WEB_TOOLS_PROJECT}/app/config/config.php
17-
cd ${WEB_TOOLS_PROJECT}
14+
rm -rf webtools
15+
phalcon project --name=webtools
16+
#phalcon project --directory=$HOME --name=webtools
17+
#sed -i "s/'dbname' => 'test',/'dbname' => 'devtools',/g" ${WEB_TOOLS_PROJECT}/app/config/config.php
18+
sed -i "s/database->charset/database->charset,\n\t\t'port' => \$config->database->port/g" webtools/app/config/services.php
19+
#cd ${WEB_TOOLS_PROJECT}
20+
cd webtools
1821

1922
phalcon webtools enable
2023
phalcon serve &

.github/workflows/tests.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: "Tests"
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run-tests:
7+
name: PHP ${{ matrix.php-versions }}
8+
runs-on: ubuntu-latest
9+
env:
10+
extensions: mbstring, intl, json, phalcon-4.0.5, mysql, pgsql, xdebug
11+
key: cache-v2.0~19.03.2020
12+
services:
13+
mysql:
14+
image: mysql:5.7
15+
env:
16+
MYSQL_DATABASE: devtools
17+
MYSQL_ROOT_PASSWORD: root
18+
ports:
19+
- 3306/tcp
20+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
21+
postgres:
22+
image: postgres:10.8
23+
ports:
24+
- 5432/tcp
25+
env:
26+
POSTGRES_DB: devtools
27+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
php-versions: ['7.2', '7.3']
32+
steps:
33+
- uses: actions/checkout@v1
34+
35+
- name: Setup cache environment
36+
id: cache-env
37+
uses: shivammathur/cache-extensions@v1
38+
with:
39+
php-version: ${{ matrix.php-versions }}
40+
extensions: ${{ env.extensions }}
41+
key: ${{ env.key }}
42+
43+
- name: Cache extensions
44+
uses: actions/cache@v1
45+
with:
46+
path: ${{ steps.cache-env.outputs.dir }}
47+
key: ${{ steps.cache-env.outputs.key }}
48+
restore-keys: ${{ steps.cache-env.outputs.key }}
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.php-versions }}
54+
extensions: ${{ env.extensions }}
55+
tools: pecl
56+
57+
- name: Get Composer Cache Directory
58+
id: composer-cache
59+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
60+
61+
- name: Cache composer dependencies
62+
uses: actions/cache@v1
63+
with:
64+
path: ${{ steps.composer-cache.outputs.dir }}
65+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
66+
restore-keys: ${{ runner.os }}-composer-
67+
68+
- name: Install Composer dependencies
69+
run: |
70+
composer install --prefer-dist --no-suggest
71+
composer require --dev phpstan/phpstan
72+
73+
- name: Initialise DataBase
74+
env:
75+
MYSQL_DB_PASSWORD: 'root'
76+
MYSQL_DB_PORT: ${{ job.services.mysql.ports['3306'] }}
77+
POSTGRES_DB_PORT: ${{ job.services.postgres.ports['5432'] }}
78+
run: bash tests/_ci/setup_dbs_github.sh
79+
80+
- name: Symbolic link Phalcon devtools
81+
run: bash ./.ci/link_devtools.sh
82+
83+
- name: Init Webtools and add ports in database setup
84+
env:
85+
MYSQL_DB_PASSWORD: 'root'
86+
MYSQL_DB_PORT: ${{ job.services.mysql.ports['3306'] }}
87+
POSTGRES_DB_PORT: ${{ job.services.postgres.ports['5432'] }}
88+
run: bash ./.ci/serve-webtools.sh
89+
90+
- name: Setup tests
91+
run: |
92+
cp tests/.env.test .env
93+
bash ./.ci/github_set_env.sh
94+
mkdir .phalcon
95+
vendor/bin/codecept build
96+
vendor/bin/phpcs
97+
98+
- name: Run test suites
99+
env:
100+
MYSQL_DB_PASSWORD: 'root'
101+
MYSQL_DB_PORT: ${{ job.services.mysql.ports['3306'] }}
102+
POSTGRES_DB_PORT: ${{ job.services.postgres.ports['5432'] }}
103+
if: success()
104+
run: |
105+
vendor/bin/codecept run --ext DotReporter acceptance -g mysql --env mysql
106+
vendor/bin/codecept run --ext DotReporter acceptance -g pgsql --env pgsql
107+
vendor/bin/codecept run --ext DotReporter acceptance -g common --coverage-xml=coverage-common-${{ matrix.php-versions }}.xml
108+
vendor/bin/codecept run --ext DotReporter unit --coverage-xml=coverage-unit-${{ matrix.php-versions }}.xml
109+
vendor/bin/codecept run --ext DotReporter functional --coverage-xml=coverage-functional-${{ matrix.php-versions }}.xml
110+
vendor/bin/codecept run --ext DotReporter console --coverage-xml=coverage-console-${{ matrix.php-versions }}.xml
111+
112+
- name: If fail - Check Config file
113+
env:
114+
MYSQL_DB_PORT: ${{ job.services.mysql.ports['3306'] }}
115+
POSTGRES_DB_PORT: ${{ job.services.postgres.ports['5432'] }}
116+
if: failure()
117+
run: |
118+
cat webtools/app/config/config.php
119+
cat webtools/app/config/services.php
120+
echo "<?php print_r(include('webtools/app/config/config.php')) ?>" > content_config.php
121+
php content_config.php
122+
php tests/debug.php
123+
124+
- uses: actions/upload-artifact@v1
125+
if: failure()
126+
with:
127+
name: Codeception Logs
128+
path: tests/_output
129+
130+
- name: Check psalm
131+
run: vendor/bin/psalm --show-info=false
132+
133+
- name: Check phpstan
134+
run: vendor/bin/phpstan analyse -l 5 -c phpstan.neon src -v
135+
136+
- name: Upload coverage to Codecov
137+
if: success()
138+
uses: codecov/codecov-action@v1
139+
with:
140+
token: ${{secrets.CODECOV_TOKEN}}
141+
file: ./tests/_output/coverage-*.xml

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ env:
3737
- PHALCON_VERSION=v4.0.0
3838

3939
before_install:
40-
- source $TRAVIS_BUILD_DIR/tests/_ci/environment
41-
- export $(cut -d= -f1 $TRAVIS_BUILD_DIR/tests/_ci/environment)
4240
- if [ -n "$GITHUB_TOKEN" ]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi;
4341
- bash tests/_ci/setup_dbs.sh
4442

@@ -59,12 +57,19 @@ before_script:
5957
- composer require --dev phpstan/phpstan
6058
- ln -s $PWD/phalcon ~/bin/phalcon
6159
- .ci/serve-webtools.sh
60+
- sed -i "s/getenv('POSTGRES_DB_PORT')/5432/g" tests/_data/acceptance/pgsql/config.php
61+
- cp tests/.env.test .env
6262

6363
script:
6464
- mkdir .phalcon
6565
- vendor/bin/phpcs
6666
- vendor/bin/codecept build
67-
- vendor/bin/codecept run --coverage-xml
67+
- vendor/bin/codecept run --ext DotReporter acceptance -g mysql --env mysql
68+
- vendor/bin/codecept run --ext DotReporter acceptance -g pgsql --env pgsql
69+
- vendor/bin/codecept run --ext DotReporter acceptance -g common --coverage-xml=coverage-common-$PHAR_PHP_VERSION.xml
70+
- vendor/bin/codecept run --ext DotReporter unit --coverage-xml=coverage-unit-$PHAR_PHP_VERSION.xml
71+
- vendor/bin/codecept run --ext DotReporter functional --coverage-xml=coverage-functional-$PHAR_PHP_VERSION.xml
72+
- vendor/bin/codecept run --ext DotReporter console --coverage-xml=coverage-console-$PHAR_PHP_VERSION.xml
6873
- vendor/bin/psalm --show-info=false
6974
- vendor/bin/phpstan analyse -l 5 -c phpstan.neon src -v
7075

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# [4.0.2](https://github.com/phalcon/cphalcon/releases/tag/v4.0.2) (2020-04-11)
2+
## Added
3+
- Added launcher.bat to run cli with Windows and used DIRECTORY_SEPARATOR to find the file. [#1440](https://github.com/phalcon/phalcon-devtools/issues/1440) [@jenovateurs](https://github.com/jenovateurs)
4+
## Changed
5+
6+
## Fixed
7+
- Fixed include order of files in created project [#1417](https://github.com/phalcon/phalcon-devtools/issues/1417)
8+
- Fixed Scaffold templates errors and phpstan errors. [#1429](https://github.com/phalcon/phalcon-devtools/issues/1429) [@jenovateurs](https://github.com/jenovateurs)
9+
- Fixed duplicate camelCase properties [#1433](https://github.com/phalcon/phalcon-devtools/pull/1433)
10+
- Fixed webtools not enabled by default when creating a new project [#1410](https://github.com/phalcon/phalcon-devtools/issues/1410) [@jenovateurs](https://github.com/jenovateurs)

Makefile

Lines changed: 0 additions & 8 deletions
This file was deleted.

build/BuildPharDockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

phpstan.neon

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ parameters:
44
excludes_analyse:
55
- %rootDir%/../../../src/Generator/*
66
- %rootDir%/../../../src/Commands/DotPhalconMissingException.php
7+
- %rootDir%/../../../src/Mvc/Dispatcher/ErrorHandler.php
78
ignoreErrors:
89
- '#Strict comparison using === between#'
910
- '#Result of && is always true#'
10-
- '#Result of || is always true#'
11+
- '#Result of \|\| is always true#'
1112
- '#Parameter \#1 \$adapter of class Phalcon\\Cache constructor expects#'
1213
- '#Parameter \#1 \$eventsManager of method Phalcon#'
14+
- '#Parameter \#1 \$exception_handler of function set_exception_handler expects#'
15+
- '#Parameter \#1 \$function of function register_shutdown_function expects callable()#'
16+
- '#Call to an undefined method [a-zA-Z0-9\\_]+::getShared\(\)#'
1317
reportUnmatchedIgnoredErrors: false

src/Access/Manager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
use Phalcon\Di\Injectable;
1616
use Phalcon\Events\Event;
1717
use Phalcon\Mvc\Dispatcher;
18+
use Phalcon\Events\ManagerInterface;
1819

20+
/**
21+
* @property ManagerInterface $eventsManager
22+
*/
1923
class Manager extends Injectable
2024
{
2125
const EXCEPTION_ACTION_DISALLOWED = 10;

0 commit comments

Comments
 (0)