Skip to content

Commit 83e4a57

Browse files
authored
Merge pull request #1 from Codeception/phalcon4
Phalcon 4
2 parents 54ae6bf + 03456c7 commit 83e4a57

40 files changed

+8019
-0
lines changed

.env.example

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DB_ADAPTER=mysql
2+
DB_HOST=127.0.0.1
3+
DB_NAME=phalcon
4+
DB_USERNAME=root
5+
DB_PASSWORD=password

.gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Exclude files that don't need to be present in packages (so they're not downloaded by Composer)
2+
/.gitattributes export-ignore
3+
/.gitignore export-ignore
4+
/Robofile.php export-ignore
5+
/*.md export-ignore
6+
/*.yml export-ignore
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Static Code Analysis
2+
# This workflow is triggered on pushes to the repository.
3+
on: [push, pull_request]
4+
5+
jobs:
6+
phpcs:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2-beta
10+
with:
11+
fetch-depth: 1
12+
- name: Run PHP_CodeSniffer
13+
run: docker run --rm -v $(pwd):/data cytopia/phpcs --standard=./phpcs.xml

.github/workflows/tests.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# GitHub Action for Phalcon with MySQL
2+
## Notes
3+
## Make sure you have .env.example or .env file in your project
4+
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
5+
name: Testing Phalcon with MySQL
6+
on: [push, pull_request]
7+
jobs:
8+
phalcon:
9+
name: Phalcon (PHP ${{ matrix.php-versions }})
10+
runs-on: ubuntu-latest
11+
env:
12+
DB_ADAPTER: mysql
13+
DB_HOST: 127.0.0.1
14+
DB_NAME: phalcon
15+
DB_USERNAME: root
16+
DB_PASSWORD: password
17+
services:
18+
mysql:
19+
image: mysql:5.7
20+
env:
21+
MYSQL_ALLOW_EMPTY_PASSWORD: false
22+
MYSQL_ROOT_PASSWORD: password
23+
MYSQL_DATABASE: phalcon
24+
ports:
25+
- 3306
26+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
php-versions: ['7.2', '7.3', '7.4']
31+
# For phalcon 3.x, use
32+
# php-versions: ['7.0', '7.1', '7.2', '7.3']
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v1
36+
- name: Setup PHP, with composer and extensions
37+
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
38+
with:
39+
php-version: ${{ matrix.php-versions }}
40+
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
41+
coverage: xdebug #optional
42+
- name: Get composer cache directory
43+
id: composer-cache
44+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
- name: Cache composer dependencies
46+
uses: actions/cache@v1
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
# Use composer.json for key, if composer.lock is not committed.
50+
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
51+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
52+
restore-keys: ${{ runner.os }}-composer-
53+
- name: Install Composer dependencies
54+
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --ignore-platform-reqs
55+
- name: Prepare the application
56+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
57+
- name: Run Tests
58+
run: |
59+
vendor/bin/codecept build
60+
vendor/bin/codecept run unit
61+
env:
62+
DB_PORT: ${{ job.services.mysql.ports['3306'] }}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.idea/
2+
/vendor/
3+
/framework-tests
4+
.env

.travis.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language: php
2+
3+
php:
4+
- 7.2
5+
- 7.3
6+
- 7.4
7+
8+
# faster builds on new travis setup not using sudo
9+
sudo: false
10+
11+
services:
12+
- mysql
13+
14+
install:
15+
- '[[ -z "$CI_USER_TOKEN" ]] || composer config github-oauth.github.com ${CI_USER_TOKEN};'
16+
- travis_retry composer self-update && composer --version
17+
- travis_retry composer update --prefer-dist --no-interaction
18+
- git clone -q --depth=1 https://github.com/Codeception/phalcon-demo.git framework-tests
19+
- git --git-dir framework-tests/.git log -n 1
20+
- git clone -q --depth=1 https://github.com/phalcon/cphalcon.git -b v4.0.0-RC.3
21+
- (cd cphalcon/build; bash ./install --phpize $(phpenv which phpize) --php-config $(phpenv which php-config) &>/dev/null && phpenv config-add ../tests/_ci/phalcon.ini &> /dev/null)
22+
- travis_retry composer update -d framework-tests --no-dev --prefer-dist --no-interaction
23+
- php ./vendor/bin/codecept build -c framework-tests
24+
25+
before_script:
26+
- 'mysql -e "CREATE DATABASE phalcon_demo CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"'
27+
- 'cat framework-tests/schemas/phalcon_demo.sql | mysql phalcon_demo'
28+
script:
29+
- php ./vendor/bin/codecept run unit

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#### 1.0.0
2+
3+
* Support Phalcon 4.0.0-RC.3

Robofile.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
require __DIR__ . '/vendor/autoload.php';
4+
5+
use Codeception\Module\Phalcon4;
6+
use Codeception\Util\DocumentationHelpers;
7+
8+
class RoboFile extends \Robo\Tasks
9+
{
10+
use DocumentationHelpers;
11+
12+
public function buildDocs()
13+
{
14+
$className = Phalcon4::class;
15+
$classPath = str_replace('\\', '/', $className);
16+
$source = "https://github.com/Codeception/module-phalcon/tree/master/src/$classPath.php";
17+
$sourceMessage = '<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="' . $source . '">Help us to improve documentation. Edit module reference</a></div>';
18+
$documentationFile = 'documentation.md';
19+
$this->generateDocumentationForClass($className, $documentationFile, $sourceMessage);
20+
}
21+
}

codeception.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
paths:
2+
tests: tests
3+
output: tests/_output
4+
data: tests/_data
5+
support: tests/_support
6+
envs: tests/_envs
7+
actor_suffix: Tester
8+
bootstrap: _bootstrap.php
9+
extensions:
10+
enabled:
11+
- Codeception\Extension\RunFailed
12+
params:
13+
- .env
14+
modules:
15+
enabled:
16+
- Db:
17+
dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%;port=%DB_PORT%'
18+
user: '%DB_USERNAME%'
19+
password: '%DB_PASSWORD%'
20+
populate: no
21+
cleanup: true
22+
dump: 'tests/_data/structure.sql'

composer.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name":"codeception/module-phalcon4",
3+
"description":"Codeception module for Phalcon 4 framework",
4+
"keywords":["codeception", "phalcon"],
5+
"homepage":"https://codeception.com/",
6+
"type":"library",
7+
"license":"MIT",
8+
"authors":[
9+
{
10+
"name":"Ruud Boon"
11+
}
12+
],
13+
"minimum-stability": "RC",
14+
15+
"require": {
16+
"php": ">=7.2.0 <8.0",
17+
"codeception/lib-innerbrowser": "dev-master | ^1.0",
18+
"codeception/codeception": "4.0.x-dev | ^4.0",
19+
"vlucas/phpdotenv": "^4.1"
20+
},
21+
"require-dev": {
22+
"codeception/util-robohelpers": "dev-master",
23+
"codeception/module-asserts": "dev-master | ^1.0",
24+
"codeception/module-phpbrowser": "dev-master | ^1.0",
25+
"squizlabs/php_codesniffer": "^3.4",
26+
"vimeo/psalm": "^3.6",
27+
"codeception/module-db": "^1.0"
28+
},
29+
"autoload":{
30+
"classmap": ["src/"]
31+
},
32+
"config": {
33+
"classmap-authoritative": true
34+
}
35+
}

0 commit comments

Comments
 (0)