Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Atk 4.0 #10

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0cd2417
Add Mailer SendMail
abbadon1334 Jan 25, 2022
75cb09a
Removed UI admin, nearly useless
abbadon1334 Jan 25, 2022
a71b7dc
Upgrade composer.json
abbadon1334 Jan 25, 2022
f52ccb0
CleanUp and upgrade for Atk4 3.1
abbadon1334 Jan 25, 2022
61f7701
Add php < 8.2 to test and composer
abbadon1334 Jan 25, 2022
7d42747
Align UnitTests to ATK ecosystem
abbadon1334 Jan 25, 2022
f023dba
CleanUp
abbadon1334 Jan 25, 2022
88df496
Fix Memory leaks
abbadon1334 Jan 26, 2022
55f57b2
Rename Class SMTP to Smtp
abbadon1334 Jan 26, 2022
ff177f4
Simplify initialization
abbadon1334 Jan 26, 2022
3367514
Add to GitIgnore demos/db.php & demos/_demo-data/db.sqlite
abbadon1334 Jan 27, 2022
ba76f70
Add strict type to string mail_template_model in Mail
abbadon1334 Jan 27, 2022
6d6d203
Try fix MemLeak
abbadon1334 Jan 27, 2022
afd9f8a
Remove from Unit GitAction Behat tests part
abbadon1334 Jan 27, 2022
b3f9c34
Fix request changes
abbadon1334 Jan 27, 2022
710b207
Remove not required unused library and align phpmailer version
abbadon1334 Jan 28, 2022
73dd789
Edit README.md
abbadon1334 Jan 28, 2022
fa23f1d
Update README.md
abbadon1334 Jan 28, 2022
e2551c3
Merge branch 'develop' into update-readme
abbadon1334 Jan 28, 2022
4028c28
Update composer for next-release
abbadon1334 Jan 28, 2022
51d4e3c
Moved Ui to required and clean-up unused
abbadon1334 Jan 28, 2022
e9bfe6c
Moved Ui to required and clean-up unused
abbadon1334 Jan 28, 2022
38c14f2
Fix : Response entity error
abbadon1334 Mar 10, 2022
11483fd
Align to Atk develop
abbadon1334 Sep 11, 2022
349f4d1
Add PHPUnit php 8.2
abbadon1334 Sep 11, 2022
9c0c402
Fix composer.json
abbadon1334 Sep 11, 2022
07b55ab
Cleanup
abbadon1334 Sep 11, 2022
731c187
Change $entity->isLoaded() to null === $entity
abbadon1334 Sep 11, 2022
f5ac3ee
Update PHPCsFixer config
abbadon1334 Sep 11, 2022
a1b7a42
Clean up
abbadon1334 Sep 11, 2022
f873828
Fix composer
abbadon1334 Sep 11, 2022
9c12d50
Fix PHPUnit test App db + cleanup composer
abbadon1334 Sep 11, 2022
5d3dd18
Align with 4.0
abbadon1334 Feb 26, 2023
5552c05
Merge branch 'develop' into update/4.0
abbadon1334 Feb 26, 2023
b36aeb7
Fix Stan + Cleanup
abbadon1334 Feb 27, 2023
552445e
Redo GitActions
abbadon1334 Feb 27, 2023
5801633
Fix demo grid
abbadon1334 Feb 27, 2023
8cbed55
Fix require-dev to atk4/* ~4.0
abbadon1334 Feb 27, 2023
34d67e5
Bump require PHP <= 8.2
abbadon1334 Feb 27, 2023
a5389b7
Bump require PHP < 8.3
abbadon1334 Feb 27, 2023
e1ca92c
Fix CodingStyle
abbadon1334 Feb 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ categories:
- "Documentation :books:"
template: |
## What’s Changed
$CHANGES
$CHANGES
1 change: 0 additions & 1 deletion .github/workflows/build-docs.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ jobs:
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
with:
branch: ${{ github.ref }}.gen
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
29 changes: 18 additions & 11 deletions .github/workflows/test-unit.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
type: 'StaticAnalysis'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Configure PHP
run: |
Expand Down Expand Up @@ -62,6 +62,8 @@ jobs:
run: |
if [ "$(find demos/ -name '*.php' -print0 | xargs -0 grep -L "namespace Atk4\\\\Outbox\\\\Demos[;\\\\]" | tee /dev/fd/2)" ]; then echo 'All demos/ files must have namespace declared' && (exit 1); fi
vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --verbose
composer config --unset version && composer config --unset require-release
composer validate --strict --no-check-lock && composer normalize --dry-run --no-check-lock

- name: Run Static Analysis (only for StaticAnalysis)
if: matrix.type == 'StaticAnalysis'
Expand All @@ -77,7 +79,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
php: ['7.4', '8.0', '8.1', '8.2']
type: ['Phpunit', 'Phpunit Lowest']
include:
- php: '8.1' # TODO replace with 'latest' once it represents at least PHP 8.1
Expand All @@ -104,13 +106,12 @@ jobs:
ACCEPT_EULA: Y
SA_PASSWORD: atk4_pass
oracle:
image: gvenzl/oracle-xe:18
image: gvenzl/oracle-xe:18-slim-faststart
env:
ORACLE_PASSWORD: atk4_pass
options: --health-cmd healthcheck.sh --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Configure PHP
run: |
Expand Down Expand Up @@ -145,7 +146,8 @@ jobs:
php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");'
if [ -n "$LOG_COVERAGE" ]; then mkdir coverage && cp tools/CoverageUtil.php demos; fi
/usr/lib/oracle/setup.sh
if [ -n "$LOG_COVERAGE" ]; then mkdir coverage; fi

- name: "Run tests: SQLite"
run: |
Expand All @@ -154,6 +156,7 @@ jobs:
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-sqlite.cov; fi

- name: "Run tests: MySQL"
if: success() || failure()
env:
DB_DSN: "mysql:host=mysql;dbname=atk4_test"
DB_USER: atk4_test_user
Expand All @@ -164,7 +167,8 @@ jobs:
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mysql.cov; fi

- name: "Run tests: MariaDB"
- name: "Run tests: MariaDB (only for cron)"
if: (success() || failure()) && github.event_name == 'schedule'
env:
DB_DSN: "mysql:host=mariadb;dbname=atk4_test"
DB_USER: atk4_test_user
Expand All @@ -175,7 +179,8 @@ jobs:
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mariadb.cov; fi

- name: "Run tests: PostgreSQL"
- name: "Run tests: PostgreSQL (only for cron)"
if: (success() || failure()) && github.event_name == 'schedule'
env:
DB_DSN: "pgsql:host=postgres;dbname=atk4_test"
DB_USER: atk4_test_user
Expand All @@ -186,9 +191,10 @@ jobs:
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-postgres.cov; fi

- name: "Run tests: MSSQL"
- name: "Run tests: MSSQL (only for cron)"
if: (success() || failure()) && github.event_name == 'schedule'
env:
DB_DSN: "sqlsrv:host=mssql;dbname=master"
DB_DSN: "sqlsrv:host=mssql;dbname=master;driverOptions[TrustServerCertificate]=1"
DB_USER: sa
DB_PASSWORD: atk4_pass
run: |
Expand All @@ -197,7 +203,8 @@ jobs:
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mssql.cov; fi

- name: "Run tests: Oracle"
- name: "Run tests: Oracle (only for cron)"
if: (success() || failure()) && github.event_name == 'schedule'
env:
DB_DSN: "oci:dbname=oracle/xe"
DB_USER: system
Expand Down
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/demos/db.php
/demos/_demo-data/db.sqlite
/demos/_demo-data/db.sqlite-journal
/demos/_db.php
32 changes: 13 additions & 19 deletions .php-cs-fixer.dist.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

$finder = PhpCsFixer\Finder::create()
->in([__DIR__])
->exclude([
'vendor',
]);
->exclude(['vendor']);

$config = new \PhpCsFixer\Config();
$config->setRiskyAllowed(true)
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' =>true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
'@PhpCsFixer:risky' => true,
'@PHP74Migration:risky' => true,
'@PHP74Migration' => true,

// required by PSR-12
'concat_space' => [
Expand All @@ -23,7 +21,7 @@
'phpdoc_types' => [
// keep enabled, but without "alias" group to not fix
// "Callback" to "callback" in phpdoc
'groups' => ['simple', 'meta']
'groups' => ['simple', 'meta'],
],
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
Expand All @@ -34,10 +32,8 @@
'equal' => false,
'identical' => false,
],
'native_constant_invocation' => true,
'native_function_invocation' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'void_return' => false,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
Expand All @@ -48,22 +44,20 @@
'no_superfluous_elseif' => false,
'ordered_class_elements' => false,
'php_unit_internal_class' => false,
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
],
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => false,
'return_assignment' => false,
'comment_to_phpdoc' => false,
'list_syntax' => ['syntax' => 'short'],
'general_phpdoc_annotation_remove' => [
'annotations' => ['author', 'copyright', 'throws'],
],
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => false,
],

// fn => without curly brackets is less readable,
// also prevent bounding of unwanted variables for GC
'use_arrow_functions' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');

return $config;
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');
Empty file modified codecov.yml
100644 → 100755
Empty file.
16 changes: 10 additions & 6 deletions composer.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
}
],
"require": {
"php": ">=7.4 <8.2",
"atk4/data": "dev-develop",
"atk4/ui": "dev-develop",
"php": "< 8.3 >=7.4",
"atk4/data": "~4.0.0",
"atk4/ui": "~4.0.0",
"phpmailer/phpmailer": "^v6.5.3"
},
"require-release": {
"php": ">=7.4 <8.2",
"atk4/data": "~3.2.0",
"atk4/ui": "~3.2.0",
"php": ">=7.4 < 8.3",
"atk4/data": "~4.0.0",
"atk4/ui": "~4.0.0",
"phpmailer/phpmailer": "^v6.5.3"
},
"require-dev": {
Expand All @@ -48,6 +48,10 @@
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true
},
"sort-packages": true
}
}
3 changes: 2 additions & 1 deletion demos/_demo-data/create-db.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
if (!file_exists($sqliteFile)) {
new Persistence\Sql('sqlite:' . $sqliteFile);
}

unset($sqliteFile);

/** @var Persistence\Sql $db */
/** @var Persistence|Persistence\Sql $db */
require_once __DIR__ . '/../init-db.php';

echo 'GITHUB_JOB : ' . getenv('GITHUB_JOB') . "\n\n";
Expand Down
66 changes: 1 addition & 65 deletions demos/_includes/App.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,7 @@

namespace Atk4\Outbox\Demos;

use Atk4\Outbox\Model\Mail;
use Atk4\Outbox\Model\MailTemplate;
use Atk4\Ui\Layout;
use Atk4\Ui\Loader;

/**
* Example implementation of your Authenticated application.
*/
class App extends \Atk4\Ui\App
{
public $title = 'Demo App';

protected function init(): void
{
parent::init();

$this->initLayout([Layout\Admin::class]);

$loader = Loader::addTo($this);
$loader->set(function (Loader $l) {
$route = $l->getApp()->stickyGet('route');
$route = empty($route) ? 'mail' : $route;

switch ($route) {
case 'mail':
$grid = \Atk4\Ui\Grid::addTo($l);

$model = new Mail($this->db);
$model->getField('html')->system = true;
$model->addExpression('time', $model->refLink('response')->action('field', ['timestamp']));
$model->setOrder('id', 'DESC');

$grid->setModel($model);

break;
case 'template':
$crud = \Atk4\Ui\Crud::addTo($l, [
'displayFields' => [
'identifier',
'subject',
],
'addFields' => [
'identifier',
'subject',
'text',
'html',
],
'editFields' => [
'identifier',
'subject',
'text',
'html',
],
]);

$crud->setModel(new MailTemplate($this->db));

break;
}
});

/** @var Layout\Admin $layout */
$layout = $this->layout;

$layout->menuLeft->addItem(['Mail Tracking', 'icon' => 'envelope'])->on('click', $loader->jsLoad(['route' => 'mail']));
$layout->menuLeft->addItem(['Template Admin', 'icon' => 'cogs'])->on('click', $loader->jsLoad(['route' => 'template']));
}
public $title = 'Outbox Demo App';
}
1 change: 1 addition & 0 deletions demos/db.default.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
if (!file_exists($sqliteFile)) {
throw new \Exception('Sqlite database does not exist, create it first.');
}

$db = new Persistence\Sql('sqlite:' . $sqliteFile);
unset($sqliteFile);
Loading