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 to 5.x #338

Merged
merged 333 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
333 commits
Select commit Hold shift + click to select a range
c27c98d
Merge pull request #325 from acquia/MAUT-10760
dongilbert Nov 13, 2023
48eb787
PHPStan fix again
dongilbert Nov 13, 2023
cc94188
PHPStan
dongilbert Nov 13, 2023
7813418
PHPStan
dongilbert Nov 13, 2023
2f1711e
PHPStan
dongilbert Nov 13, 2023
7d2dc59
Update README.md
ts-navghane Nov 17, 2023
713ebb3
Merge pull request #326 from acquia/update-readme-for-workflow
ts-navghane Nov 21, 2023
a747457
Remove PUT from the available item operations for the custom_objects …
dongilbert Nov 28, 2023
ee55e19
Merge pull request #327 from acquia/MAUT-10984
rohitp19 Nov 29, 2023
ec345f7
as PUT method is removed we are using PATCH insted
rahuld-dev Nov 29, 2023
b0d76f2
Merge pull request #328 from acquia/MAUT-10984-tests
dadarya0 Nov 29, 2023
37dfa9c
Merge remote-tracking branch 'origin/staging' into MAUT-8990
ts-navghane Dec 5, 2023
8a88278
fix segement filter issue in custom object
dadarya0 Dec 20, 2023
53bd856
fix test cases
dadarya0 Dec 20, 2023
dbb0717
add code coverage
dadarya0 Dec 20, 2023
4fedfd2
fix phpstan issue
dadarya0 Dec 20, 2023
065354e
fix failing test case
dadarya0 Dec 20, 2023
53f3a08
fixing patch request
rahuld-dev Dec 21, 2023
9359226
skip setDefaultValuesForMissingFields for patch request
rahuld-dev Dec 26, 2023
bc7d8dc
adding comment
rahuld-dev Dec 26, 2023
bf5491f
Merge pull request #331 from acquia/MAUT-11028
dadarya0 Dec 28, 2023
093016b
updating note for implementation
rahuld-dev Dec 28, 2023
d8057d3
Merge remote-tracking branch 'origin/staging' into MAUT-8990
ts-navghane Dec 28, 2023
26a9063
Fix warnings in test suite for PHP8.0 upgrade
ts-navghane Dec 28, 2023
858c8c3
Remove unused import
ts-navghane Dec 28, 2023
8c0ae0d
Merge pull request #332 from acquia/MAUT-10983
rahuld-dev Jan 3, 2024
7d96d3a
Merge remote-tracking branch 'origin/staging' into MAUT-8990
ts-navghane Jan 3, 2024
c871af0
Merge pull request #319 from acquia/MAUT-8990
himanshuprajapati-1 Jan 9, 2024
b9612ad
check lead exist before link to custom item
rahuld-dev Feb 2, 2024
82594f2
fixed tests
rahuld-dev Feb 2, 2024
d9e7e8d
adding tests
rahuld-dev Feb 2, 2024
2b0b174
removed php8 only compatibal code
rahuld-dev Feb 5, 2024
8eaf7fd
change warning type
rahuld-dev Feb 5, 2024
9783a29
correct message
rahuld-dev Feb 5, 2024
ab73600
changed warning type
rahuld-dev Feb 5, 2024
43909d0
fix tests
rahuld-dev Feb 5, 2024
5456d27
check for method exists and csfix
rahuld-dev Feb 6, 2024
fb35142
Merge pull request #335 from acquia/MAUT-11097
dadarya0 Feb 8, 2024
0b33dd8
Add merge filter query
ts-navghane Jan 9, 2024
f4abfd3
Remove const is defined check
ts-navghane Jan 9, 2024
24872e6
Fix test case by adding config param
ts-navghane Jan 9, 2024
ea96447
Add function to check if custom object filters are mergable
ts-navghane Feb 12, 2024
1551e88
Revert CustomFieldFilterQueryBuilder
ts-navghane Feb 12, 2024
1887853
Update services
ts-navghane Feb 12, 2024
62ae4c4
Add CustomObjectMergedFilterQueryBuilder
ts-navghane Feb 12, 2024
17518f3
Use CustomObjectMergedFilterQueryBuilder
ts-navghane Feb 12, 2024
be3a513
Check for custom item filter
ts-navghane Feb 12, 2024
d43b872
Change merge filter logic
ts-navghane Feb 12, 2024
11ade4e
Make consts
ts-navghane Feb 12, 2024
3874993
Fix test cases
ts-navghane Feb 12, 2024
50dc8ad
Test with custom_object_merge_filter param
ts-navghane Feb 12, 2024
7270998
Move test to appropriate class name
ts-navghane Feb 12, 2024
003090b
Rename test case
ts-navghane Feb 12, 2024
866a380
Rename test case
ts-navghane Feb 13, 2024
5e5cda9
Revert unnecessary code
ts-navghane Feb 13, 2024
c8eff06
Remove union return type declaration in favour of PHP7.4
ts-navghane Feb 13, 2024
d9af885
Remove not exists in favour of negative filters
ts-navghane Feb 14, 2024
f3ff968
Fix contact not getting added when one segment filter is used
ts-navghane Feb 15, 2024
008c9d6
Merge branch 'feature/adapt-to-mautic-v5-Twig-to-merge' into update-t…
volha-pivavarchyk Feb 18, 2024
c948033
Merge branch 'feature/adapt-to-mautic-v5-transform-controllers' into …
volha-pivavarchyk Feb 18, 2024
0ab819c
fix dependencies
volha-pivavarchyk Feb 18, 2024
92d8089
add parent constructor call
volha-pivavarchyk Feb 19, 2024
5ea1512
remove duplicate dependencies; change deprecated methods
volha-pivavarchyk Feb 26, 2024
eb437c4
fix inserting variable into string
volha-pivavarchyk Feb 27, 2024
46aeed5
fix an event dispatching issue
volha-pivavarchyk Feb 27, 2024
5fa003f
fix import with contact ids
volha-pivavarchyk Feb 27, 2024
298c70f
fix the allowed memory size exhausted issue
volha-pivavarchyk Feb 27, 2024
cc8e328
fix the inheritance model issue
volha-pivavarchyk Feb 27, 2024
1da392f
Merge pull request #333 from acquia/MAUT-11028-2
ts-navghane Feb 28, 2024
675d894
Handling custom item links when merging contacts
escopecz Mar 20, 2024
a6156be
Merge remote-tracking branch 'origin' into MAUT-11209
escopecz Mar 28, 2024
9a223d2
Merge pull request #340 from acquia/MAUT-11209
escopecz Apr 5, 2024
f18bd5e
Adding GH Actions config
escopecz Feb 28, 2023
e8fe852
Adding PHPSTAN Baseline for existing issues
escopecz Mar 24, 2023
2aca796
Remove dead code flagged by Rector
escopecz Mar 27, 2023
b5c3f72
Fixing PHPUNIT config
escopecz Mar 27, 2023
79ec236
Debugging tests
escopecz Mar 29, 2023
0fb33d9
PHPSTAN baseline for each PHP version
escopecz Mar 29, 2023
fcad35a
Fixing tests
escopecz Mar 29, 2023
1fb88be
Some tests require theofidry/alice-data-fixtures
escopecz Mar 29, 2023
7161a58
Test gh-actions
aadarshjain-dev Apr 3, 2024
f1b5d79
tests.yaml update
aadarshjain-dev Apr 5, 2024
c144ecf
PHPSTAN baseline (debug) update
aadarshjain-dev Apr 5, 2024
5b22c44
Comment PHPUNIT TESTS
aadarshjain-dev Apr 8, 2024
a56bec8
Comment Coverage Report step
aadarshjain-dev Apr 8, 2024
4717ee3
skip test
aadarshjain-dev Apr 9, 2024
bde8f28
skip test
aadarshjain-dev Apr 9, 2024
8044cc6
revert
aadarshjain-dev Apr 9, 2024
c91a61b
print commit id
aadarshjain-dev Apr 10, 2024
cba0e15
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
ac64be6
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
78a1758
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
c8e162e
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
696a068
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
c7f77e3
Push commit to mc-cs
aadarshjain-dev Apr 10, 2024
5fb43ee
static analysis add
aadarshjain-dev Apr 15, 2024
62ec5a7
Moving Install composer up and comment phpstan baseline
aadarshjain-dev Apr 15, 2024
67b67a3
Upgrade php and mysql version
aadarshjain-dev Apr 15, 2024
9c78a79
Uncoomment PHPSTAN step
aadarshjain-dev Apr 15, 2024
82a3244
comment phpstan
aadarshjain-dev Apr 15, 2024
9f0e8e7
Debug: regenerating PHPSTAN baseline
escopecz Apr 23, 2024
368f761
Updating PHPSTAN baseline, enabling PHPSTAN check
escopecz Apr 23, 2024
a4bffc0
Clearing up the baseline files to generate them from scratch
escopecz Apr 23, 2024
a75ede8
Running PHPSTAN with fresh baselines
escopecz Apr 23, 2024
ead2bfe
Updating action versions to avoid NodeJS warnings
escopecz Apr 23, 2024
cf257fd
Removing the pull_request settings hoping the CI will run on the comm…
escopecz Apr 23, 2024
4bc2ef6
Disabling composer cache as theofidry/alice-data-fixtures doesn't see…
escopecz Apr 23, 2024
618d446
Would it help to run the commands separately?
escopecz Apr 23, 2024
5f1dc61
Or lock the version?
escopecz Apr 23, 2024
ce9fc29
The dependency must be also set in kernel. Let's skip the tests that …
escopecz Apr 23, 2024
6cfe3a0
The coverage report contains whole Mautic. Testing something different
escopecz Apr 23, 2024
df6b1cd
Fixing kernel class
escopecz Apr 23, 2024
7125a73
Another attempt to resolve the kernel class issue
escopecz Apr 23, 2024
c90ce08
Do we need to set KERNEL_CLASS?
escopecz Apr 24, 2024
4b8c155
Check API request by the controller name
fedys May 3, 2024
bf41a9d
fix customobject fetch from typeoparatorprovider
May 13, 2024
abb6545
Merge branch 'staging' into MAUT-11442
May 13, 2024
a2d6a5b
split into 2 line
May 14, 2024
c40f00b
var name change
May 14, 2024
cdc997a
empty and neq operator fixed
fedys May 14, 2024
49f3bfe
pass true for $filterAlreadyNegated only from CustomFieldFilterQueryB…
fedys May 15, 2024
d05bc70
CustomItemRelationQueryBuilderTestCase was not included within the te…
fedys May 15, 2024
27ee543
Added functional tests for "not equal" and "empty" operators
fedys May 15, 2024
a40a65d
adding KERNEL_CLASS
rahuld-dev May 16, 2024
63753f2
fixing test
rahuld-dev May 16, 2024
6702b8b
fixing tests
rahuld-dev May 16, 2024
788349f
Update Tests/Functional/Segment/Query/Filter/NegativeOperatorFilterQu…
fedys May 16, 2024
1c914e9
Merge pull request #343 from acquia/MAUT-11469
fedys May 16, 2024
07e9ffd
Merge branch 'staging' into MAUT-11107-2
fedys May 16, 2024
bfee8df
Merge branch 'staging' into MAUT-11442
May 17, 2024
fce39f8
enabling phpstan and fixed issues
rahuld-dev May 17, 2024
c8d16d4
I think composer install should run after install mautic
rahuld-dev May 22, 2024
906ff6e
removed dependacy install after mautic installation
rahuld-dev May 24, 2024
f03dde5
removed vendor from scanDirectories from neon file
rahuld-dev May 24, 2024
65d3969
added between/not between operator for date type field
dadarya0 May 28, 2024
ad49089
fix sonar issue
dadarya0 May 28, 2024
1901df0
add functional test case
dadarya0 May 29, 2024
0ada11a
fix syntax
dadarya0 May 29, 2024
0637479
fix issue for development branch failing
dadarya0 May 29, 2024
9f20945
Adding inTheLast and inTheNext operator for dat and datetime type fields
rahuld-dev May 29, 2024
027fb7d
Fixed CampaignConditionTest
fedys May 29, 2024
eedf98c
phpstan-ignore
fedys May 29, 2024
cc078c3
phpstan-ignore
fedys May 29, 2024
3bd500d
Comments for workarounds
fedys May 30, 2024
d7ea1cc
Merge pull request #345 from acquia/MAUT-11107-2
fedys May 30, 2024
39584cb
Merge pull request #307 from acquia/gh-actions
fedys May 30, 2024
98329f2
CS fixes
fedys May 30, 2024
00488a8
NegativeOperatorFilterQueryBuilderTest fixed
fedys May 30, 2024
46dc549
NegativeOperatorFilterQueryBuilderTest fixed
fedys May 30, 2024
9852b62
Merge branch 'staging' into MAUT-11443
fedys May 30, 2024
35cc85d
Merge branch 'staging' into MAUT-11289
fedys May 30, 2024
befbb6e
Merge branch 'staging' into MAUT-11442
fedys May 30, 2024
15f11b9
Update Helper/QueryFilterHelper.php
dadarya0 Jun 4, 2024
2d5f8a8
fixc s
dadarya0 Jun 4, 2024
ee303b3
fix date issue if empty/not empty filter is used
dadarya0 Jun 4, 2024
f5870b6
Merge remote-tracking branch 'origin/staging' into MAUT-11467
dadarya0 Jun 4, 2024
0927d86
fixed UI for between op, test case WIP
aarohiprasad May 16, 2024
424b4c3
fix phpstan
dadarya0 Jun 4, 2024
e080733
Functioning code and test case for custom item between query for numbers
aarohiprasad May 16, 2024
60a58fc
better handling of types
aarohiprasad May 16, 2024
5fb0992
php7.4 syntax
aarohiprasad May 20, 2024
88046c3
removed php 8 only syntax
aarohiprasad May 21, 2024
fc96692
added test case for where assertion
aarohiprasad May 23, 2024
5755b83
fix failing test case
dadarya0 Jun 4, 2024
58ba8ca
removed extra parameter
aarohiprasad Jun 5, 2024
72372bc
syntax changes
aarohiprasad Jun 5, 2024
0a22179
Env variable MAUTIC_PROJECT_VERSION introduced
fedys Jun 5, 2024
4f5f9c4
TypeError : str_starts_with() fixed
fedys Jun 5, 2024
ca7c87b
fix same for merged filter too
dadarya0 Jun 5, 2024
2927c1a
change variable names
dadarya0 Jun 5, 2024
36aa204
fixed failing test
aarohiprasad Jun 6, 2024
946a115
Merge pull request #349 from acquia/MAUT-11467
dadarya0 Jun 12, 2024
6bac694
Merge remote-tracking branch 'origin/staging' into MAUT-11289
dadarya0 Jun 12, 2024
2b0907a
fix not beetween issue
dadarya0 Jun 12, 2024
7e8f339
Merge pull request #347 from acquia/MAUT-11289
escopecz Jun 14, 2024
204c3c1
Merge branch 'staging' into MAUT-11287
Jun 14, 2024
d351b6f
Merge pull request #346 from acquia/MAUT-11287
avikarshasaha Jun 14, 2024
95aafde
Merge branch 'staging' into MAUT-11442
Jun 14, 2024
af73a88
skip for 4.4
Jun 14, 2024
f1b50d4
skip for 4.4 csfix
Jun 14, 2024
874cdba
skip for 4.4 csfix
Jun 14, 2024
6c3b2d6
skip for 4.4 csfix
Jun 14, 2024
3cb66fc
7.4 syntax
Jun 14, 2024
c3975f8
stan fix
Jun 14, 2024
da3453e
stan fix
Jun 14, 2024
bcf0cc2
stan fix
Jun 14, 2024
064e03a
fixes phpstan
Jun 14, 2024
ccb3718
skip phpstan
Jun 14, 2024
29edd58
removing ingnore comment
Jun 14, 2024
f10ff3d
Merge pull request #344 from acquia/MAUT-11442
avikarshasaha Jun 14, 2024
7b3426b
removing unnecessary array filter
Jun 14, 2024
db126df
Merge branch 'staging' into MAUT-11443
rahuld-dev Jun 14, 2024
087e054
Merge pull request #351 from acquia/MAUT-11442
avikarshasaha Jun 14, 2024
3593179
Merge pull request #348 from acquia/MAUT-11443
rahuld-dev Jun 14, 2024
d9f24d2
Hide the new operators from campaign condition, leave them for segmen…
escopecz Jun 25, 2024
850a962
Fixing operators also for int field types
escopecz Jun 25, 2024
168dfd3
cast string
Jun 25, 2024
2d6a623
test
Jun 26, 2024
50969c6
Merge pull request #354 from acquia/MAUT-8476
avikarshasaha Jul 2, 2024
9a9ebd3
Merge pull request #353 from acquia/MAUT-11602
rahuld-dev Jul 3, 2024
089ab33
MAUT-11616 : Fix operators do not refresh after selecting a different…
rahuld-dev Jul 11, 2024
a175f47
MAUT-11617 : Campaign -> Condition -> Custom Object Field values : Da…
rahuld-dev Jul 11, 2024
61d2b9f
Replaced logger with monolog.logger.mautic (#355)
rohitp19 Jul 12, 2024
6f2784e
MAUT-11515 : Custom object date segment filters should have have same…
dadarya0 Jul 16, 2024
6ad2360
Maut 11460: Dynamic content in email builder filtered on custom objec…
avikarshasaha Jul 18, 2024
39726fc
Update Entity/CustomFieldOption.php
volha-pivavarchyk Jul 31, 2024
ed8c276
Fix EventDispatcher calling
volha-pivavarchyk Jul 31, 2024
20d80ef
Fix deprecated fetchColumn call
volha-pivavarchyk Jul 31, 2024
b7fd9da
Use appropriate service to run a command in the test
volha-pivavarchyk Jul 31, 2024
c31a11a
Add #[AllowDynamicProperties] attribute to allow using dynamic properies
volha-pivavarchyk Aug 1, 2024
1306c7e
Fix tests of controllers
volha-pivavarchyk Aug 4, 2024
bc9f3c2
Fix test of controllers
volha-pivavarchyk Aug 6, 2024
38160c7
Fix controller tests
volha-pivavarchyk Aug 7, 2024
03141ce
Fix controller tests
volha-pivavarchyk Aug 8, 2024
d7727f0
Fix model tests
volha-pivavarchyk Aug 8, 2024
f509b23
Fix listener tests
volha-pivavarchyk Aug 12, 2024
9346bf8
Fix Form tests
volha-pivavarchyk Aug 13, 2024
c5ae561
Fix controller tests
volha-pivavarchyk Aug 13, 2024
cae32c7
Fix repository tests
volha-pivavarchyk Aug 15, 2024
e5da856
Fix functional tests
volha-pivavarchyk Aug 19, 2024
f18bce3
Fix functional tests
volha-pivavarchyk Aug 20, 2024
176dcf1
Add a required field to fixtures
volha-pivavarchyk Aug 21, 2024
c5d3808
Fix created objects for testing
volha-pivavarchyk Aug 21, 2024
7d0e31a
Fix pagination
volha-pivavarchyk Aug 22, 2024
8de652b
Remove commented code
volha-pivavarchyk Aug 22, 2024
467455c
MAUT-11383 : incorrect date value being calculating when the segment …
dadarya0 Oct 10, 2024
4d48a9c
Merge mautic-custom/staging into update-to-5x
volha-pivavarchyk Oct 17, 2024
ef72f2c
Fix config after merging
volha-pivavarchyk Oct 17, 2024
cd4f4df
Fix a variable name
volha-pivavarchyk Oct 17, 2024
01a6620
Fix tests after merging
volha-pivavarchyk Oct 17, 2024
e13d751
Update dependencies
volha-pivavarchyk Oct 27, 2024
b6e02ff
Get the export directory using the config
volha-pivavarchyk Nov 11, 2024
abdd7f8
CS fixing
volha-pivavarchyk Nov 11, 2024
58c8b74
Remove unnesessary constant definition
volha-pivavarchyk Nov 11, 2024
b5918a8
Fix tests
volha-pivavarchyk Nov 11, 2024
bb0c1b0
Use master request instead of deprecated
volha-pivavarchyk Nov 11, 2024
b232c01
Change phpunit configuration
volha-pivavarchyk Nov 11, 2024
b8cb0d7
CS fixing
volha-pivavarchyk Nov 11, 2024
53dd21e
PHPstan fixes
volha-pivavarchyk Dec 8, 2024
9dcf0ca
PHPStan fixes some ORM deprecations
volha-pivavarchyk Dec 8, 2024
c6046be
Add phpstan baseline
volha-pivavarchyk Dec 8, 2024
9010189
Fix rector issues
volha-pivavarchyk Dec 9, 2024
336728d
Update phpstan baseline
volha-pivavarchyk Dec 9, 2024
099e034
Fix rector issues
volha-pivavarchyk Dec 9, 2024
29eb92e
Fix tests after fixing rector failures
volha-pivavarchyk Dec 9, 2024
bf6dd8e
Fix rector failures
volha-pivavarchyk Dec 9, 2024
deed85d
Temporary set a parameter to allow the pipeline to continue even if R…
volha-pivavarchyk Dec 9, 2024
ef6af4c
Remove the CI Rector's temporary setting
volha-pivavarchyk Dec 15, 2024
3c6ec3c
Fix rector issues
volha-pivavarchyk Dec 15, 2024
ade4288
Add a CI setting to crate a writable directory
volha-pivavarchyk Dec 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
148 changes: 148 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Mautic Build and Test

on:
push:
branches:
- staging # Main branch
- '[0-9]+\.[0-9]+'
- development
- beta
pull_request:

env:
PLUGIN_DIR: plugins/CustomObjectsBundle # Same as extra.install-directory-name in composer.json

jobs:
phpunit:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['8.0'] # The supported PHP versions
db-types: ['mysql'] # can be: ['mysql', 'mariadb'] but not necessary for this plugin that does not add any DB schema
mautic-versions: ['5.1'] # The supported Mautic versions

name: Tests on PHP ${{ matrix.php-versions }}, ${{ matrix.db-types }}, Mautic ${{ matrix.mautic-versions }}

services:
database:
image: ${{ matrix.db-types == 'mysql' && 'mysql:8.0' || 'mariadb:10.3' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: mautictest
ports:
- 3306
options: >-
--shm-size=2gb
--name=${{ matrix.db-types }}
--tmpfs=/var/lib/mysql
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3

steps:
- name: Checkout Mautic
uses: actions/checkout@v4
with:
repository: mautic/mautic
ref: ${{ matrix.mautic-versions }}

- name: Checkout this plugin
uses: actions/checkout@v4
with:
path: ${{ env.PLUGIN_DIR }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: -dpcov.enabled=0, pcov.directory=."
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql
coverage: pcov

- name: add MySQL config file
run: |
mysqldump --version
mysqldump --print-defaults
cp .github/ci-files/.my.cnf ~/.my.cnf
mysqldump --print-defaults

- name: Set SYMFONY_ENV to test
run: |
echo "SYMFONY_ENV=test" >> $GITHUB_ENV
echo "MAUTIC_ENV=test" >> $GITHUB_ENV

- name: Install Composer dependencies
run: |
composer install

# - name: Get composer cache directory
# id: composer-cache
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

# - name: Cache composer dependencies
# uses: actions/cache@v4
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-

- name: Install Mautic
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
run: |
cp ./.github/ci-files/local.php ./app/config/local.php
php bin/console mautic:install --force http://localhost

- name: Install Plugins
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
run: php bin/console mautic:plugins:install --env=dev

# - name: Run static analysis
# env:
# COMPOSER_ALLOW_SUPERUSER: 1
# run: composer phpstan -- --no-progress

- name: Run Code Style check
run: bin/php-cs-fixer fix ${{ env.PLUGIN_DIR }} --config=.php-cs-fixer.php -v --dry-run --show-progress=dots --diff

# - name: PHPSTAN - baseline (debug, enable if you need to regenerate baseline for all PHP versions)
# run: bin/phpstan --configuration=${{ env.PLUGIN_DIR }}/phpstan.neon --generate-baseline=var/logs/phpstan-baseline-${{ matrix.php-versions }}.neon --allow-empty-baseline

- name: PHPSTAN
run: bin/phpstan --configuration=${{ env.PLUGIN_DIR }}/phpstan.neon

- name: Rector
run: composer rector -- --dry-run --no-progress-bar ${{ env.PLUGIN_DIR }}

- name: Twig Lint
run: bin/console lint:twig ${{ env.PLUGIN_DIR }}

- name: Create writable directory
run: mkdir -p ./media/files/temp && chmod -R 777 ./media/files/temp

- name: Run PHPUNIT tests
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
# run: XDEBUG_MODE=coverage APP_DEBUG=0 php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~tests|themes|vendor~" bin/phpunit -d memory_limit=1G --bootstrap vendor/autoload.php --configuration ${{ env.PLUGIN_DIR }}/phpunit.xml --coverage-clover=${{ env.PLUGIN_DIR }}/coverage.xml --coverage-text
run: XDEBUG_MODE=coverage APP_DEBUG=0 php -dpcov.enabled=1 -dpcov.directory=. bin/phpunit -d memory_limit=1G --bootstrap vendor/autoload.php --configuration ${{ env.PLUGIN_DIR }}/phpunit.xml --filter=CustomObjectsBundle --coverage-clover=${{ env.PLUGIN_DIR }}/coverage.xml --coverage-text

# - name: Coverage report (debug)
# run: cat ${{ env.PLUGIN_DIR }}/coverage.xml

# - name: Upload coverage report
# if: ${{ matrix.php-versions == '8.0' && matrix.db-types == 'mysql' && matrix.mautic-versions == '4.4' }} # upload just once, change for your matrix
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# working-directory: ${{ env.PLUGIN_DIR }}
# verbose: true

- name: Upload logs as artifacts
uses: actions/upload-artifact@v3
with:
name: mautic-logs
path: var/logs/
34 changes: 29 additions & 5 deletions Assets/js/custom-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ CustomObjects = {
'id': valueField.attr('id'),
'name': valueField.attr('name'),
'autocomplete': valueField.attr('autocomplete'),
'value': valueField.attr('value')
'value': valueField.val()
};
const fieldType = selectedField.attr('data-field-type');

operatorSelect.empty();

Expand All @@ -67,17 +68,40 @@ CustomObjects = {
newValueField.append(
mQuery("<option></option>")
.attr('value', optionValue)
.attr('selected', valueField.attr('value') == optionValue)
.attr('selected', valueField.val() === optionValue)
.text(options[optionValue])
);
};
}
}

if (fieldType === 'date') {
newValueField.datetimepicker({
timepicker: false,
format: 'Y-m-d',
lazyInit: true,
validateOnBlur: false,
allowBlank: true,
scrollMonth: false,
scrollInput: false,
closeOnDateSelect: true
});
} else if (fieldType === 'datetime') {
newValueField.datetimepicker({
format: 'Y-m-d H:i',
lazyInit: true,
validateOnBlur: false,
allowBlank: true,
scrollMonth: false,
scrollInput: false
});
}

if (isEmptyOperator) {
newValueField.attr('readonly', true);
newValueField.val(null);
newValueField.attr('value', '');
newValueField.attr('disabled', 'disabled');
} else {
newValueField.attr('value', valueFieldAttrs['value']);
newValueField.val(valueField.val());
}

newValueField.attr(valueFieldAttrs);
Expand Down
25 changes: 8 additions & 17 deletions Command/CustomItemsScheduledExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace MauticPlugin\CustomObjectsBundle\Command;

use Mautic\CoreBundle\Helper\ExitCode;
use Mautic\CoreBundle\Templating\Helper\FormatterHelper;
use Mautic\CoreBundle\Twig\Helper\FormatterHelper;
use MauticPlugin\CustomObjectsBundle\CustomItemEvents;
use MauticPlugin\CustomObjectsBundle\Event\CustomItemExportSchedulerEvent;
use MauticPlugin\CustomObjectsBundle\Model\CustomItemExportSchedulerModel;
Expand All @@ -19,19 +18,11 @@ class CustomItemsScheduledExportCommand extends Command
{
public const COMMAND_NAME = 'mautic:custom_items:scheduled_export';

private CustomItemExportSchedulerModel $customItemExportSchedulerModel;
private EventDispatcherInterface $eventDispatcher;
private FormatterHelper $formatterHelper;

public function __construct(
CustomItemExportSchedulerModel $customItemExportSchedulerModel,
EventDispatcherInterface $eventDispatcher,
FormatterHelper $formatterHelper
private CustomItemExportSchedulerModel $customItemExportSchedulerModel,
private EventDispatcherInterface $eventDispatcher,
private FormatterHelper $formatterHelper
) {
$this->customItemExportSchedulerModel = $customItemExportSchedulerModel;
$this->eventDispatcher = $eventDispatcher;
$this->formatterHelper = $formatterHelper;

parent::__construct();
}

Expand All @@ -58,14 +49,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int

foreach ($customItemExportSchedulers as $customItemExportScheduler) {
$customItemExportSchedulerEvent = new CustomItemExportSchedulerEvent($customItemExportScheduler);
$this->eventDispatcher->dispatch(CustomItemEvents::CUSTOM_ITEM_PREPARE_EXPORT_FILE, $customItemExportSchedulerEvent);
$this->eventDispatcher->dispatch(CustomItemEvents::CUSTOM_ITEM_MAIL_EXPORT_FILE, $customItemExportSchedulerEvent);
$this->eventDispatcher->dispatch(CustomItemEvents::POST_EXPORT_MAIL_SENT, $customItemExportSchedulerEvent);
$this->eventDispatcher->dispatch($customItemExportSchedulerEvent, CustomItemEvents::CUSTOM_ITEM_PREPARE_EXPORT_FILE);
$this->eventDispatcher->dispatch($customItemExportSchedulerEvent, CustomItemEvents::CUSTOM_ITEM_MAIL_EXPORT_FILE);
$this->eventDispatcher->dispatch($customItemExportSchedulerEvent, CustomItemEvents::POST_EXPORT_MAIL_SENT);
++$count;
}

$output->writeln('CustomItem export email(s) sent: '.$count);

return ExitCode::SUCCESS;
return Command::SUCCESS;
}
}
47 changes: 16 additions & 31 deletions Command/GenerateSampleDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,28 @@
namespace MauticPlugin\CustomObjectsBundle\Command;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\ORM\EntityManager;
use MauticPlugin\CustomObjectsBundle\Helper\RandomHelper;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Style\SymfonyStyle;

class GenerateSampleDataCommand extends ContainerAwareCommand
class GenerateSampleDataCommand extends Command
{
/**
* @var EntityManager
*/
private $entityManager;

/**
* @var RandomHelper
*/
private $randomHelper;

/**
* @var Connection
*/
private $connection;
private Connection $connection;

public function __construct(
EntityManager $entityManager,
RandomHelper $randomHelper
private EntityManager $entityManager,
private RandomHelper $randomHelper
) {
parent::__construct();

$this->entityManager = $entityManager;
$this->randomHelper = $randomHelper;
$this->connection = $entityManager->getConnection();
$this->connection = $entityManager->getConnection();
}

/**
Expand Down Expand Up @@ -111,8 +96,6 @@ protected function execute(InputInterface $input, OutputInterface $output)

/**
* @return int[]
*
* @throws DBALException
*/
private function createCustomObjectsWithItems(): array
{
Expand Down Expand Up @@ -150,13 +133,16 @@ private function createCustomObjectsWithItems(): array
return [$coProductId, $cfPriceId, $coOrderId];
}

/**
* @throws Exception
*/
private function cleanupDB(): void
{
$query = 'delete from '.MAUTIC_TABLE_PREFIX.'leads where 1';
$this->connection->query($query);
$this->connection->executeQuery($query);

$query = 'delete from '.MAUTIC_TABLE_PREFIX.'custom_object where 1';
$this->connection->query($query);
$this->connection->executeQuery($query);
}

private function generateContact(int $coProductId, int $cfPriceId, int $coOrderId, int $priceLimit): void
Expand Down Expand Up @@ -220,9 +206,11 @@ private function generateProductRelations(int $contactId, int $coProductId, int
}

/**
* @param array<int|string, mixed> $row
*
* @return int Last inserted row ID
*
* @throws DBALException
* @throws Exception
*/
private function insertInto(string $table, array $row): int
{
Expand All @@ -235,13 +223,10 @@ function ($value) {
switch (gettype($value)) {
case 'string':
return "'$value'";
break;
case 'integer':
return (string) $value;
break;
case 'boolean':
return (bool) $value;
break;
default:
$type = gettype($value);
throw new \InvalidArgumentException("Unsupported type '$type' for insert query");
Expand All @@ -256,7 +241,7 @@ function ($value) {
VALUES ($values)
";

$this->connection->query($query);
$this->connection->executeQuery($query);

return (int) $this->connection->lastInsertId();
}
Expand Down
Loading
Loading