Skip to content

Commit

Permalink
Merge pull request #4 from dachcom-digital/p11
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Nov 7, 2023
2 parents 01d4da4 + 6ced0e8 commit 7e7bce0
Show file tree
Hide file tree
Showing 41 changed files with 2,926 additions and 225 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test"
PIMCORE_TEST_DB_DSN: "mysql://test:test@127.0.0.1:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes/DataObject"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767
Expand All @@ -38,12 +38,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -82,9 +82,19 @@ jobs:
run: php -v

- name: Setup MySql
run: |
sudo systemctl start mysql
mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
user: test
password: test
root-password: root
auto-start: true
my-cnf: |
max_allowed_packet=32505856
max_connections=1000
- name: Initial Database
run: mysql -utest -ptest -h127.0.0.1 -e 'CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;'

- name: Setup Chromium
run: |
Expand Down Expand Up @@ -115,7 +125,7 @@ jobs:
run: |
composer config "minimum-stability" "dev"
composer config "prefer-stable" true
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test"
Expand All @@ -37,12 +37,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
run: |
composer config "minimum-stability" "dev"
composer config "prefer-stable" true
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test"
Expand All @@ -37,12 +37,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
run: |
composer config "minimum-stability" "dev"
composer config "prefer-stable" true
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License
Copyright (C) 2022 DACHCOM.DIGITAL
Copyright (C) 2023 DACHCOM.DIGITAL

This software is available under the GNU General Public License version 3 (GPLv3).

Expand Down
36 changes: 14 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,28 @@ This Connector allows you to fetch social posts from YouTube.
### Release Plan
| Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch |
|---------|----------------------------|----------------------------|--------------|----------------|------------------------------------------------------------------------------------------|
| **2.x** | `10.1` - `10.6` | `5.4` | 05.01.2022 | Feature Branch | master |
| **3.x** | `11.0` | `6.2` | 07.11.2023 | Feature Branch | master |
| **2.x** | `10.1` - `10.6` | `5.4` | 05.01.2022 | Unsupported | [2.x](https://github.com/dachcom-digital/pimcore-social-data-youtube-connector/tree/2.x) |
| **1.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 22.10.2020 | Unsupported | [1.x](https://github.com/dachcom-digital/pimcore-social-data-youtube-connector/tree/1.x) |

## Installation

### I. Add Dependency
```json
"require" : {
"dachcom-digital/social-data" : "~2.0.0",
"dachcom-digital/social-data-youtube-connector" : "~2.0.0",
"dachcom-digital/social-data" : "~3.0.0",
"dachcom-digital/social-data-youtube-connector" : "~3.0.0",
}
```

### II. Register Connector Bundle
Add Bundle to `bundles.php`:
```php
// src/Kernel.php
namespace App;

use Pimcore\HttpKernel\BundleCollection\BundleCollection;

class Kernel extends \Pimcore\Kernel
{
public function registerBundlesToCollection(BundleCollection $collection)
{
$collection->addBundle(new SocialData\Connector\Youtube\SocialDataYoutubeConnectorBundle());
}
}
return [
SocialData\Connector\Youtube\SocialDataYoutubeConnectorBundle::class => ['all' => true],
];
```

### III. Install Assets
### Install Assets
```bash
bin/console assets:install public --relative --symlink
```
Expand Down Expand Up @@ -73,11 +65,11 @@ YouTube is auto connected after a valid API Key has been set.

## Feed Configuration

| Name | Description
|------|----------------------|
| `Fetch Type` | Choose the fetch type. Values: `Client ID` or `Playlist ID` |
| `Value` | The client id or playlist id |
| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 50) |
| Name | Description |
|--------------|-------------------------------------------------------------------------------|
| `Fetch Type` | Choose the fetch type. Values: `Client ID` or `Playlist ID` |
| `Value` | The client id or playlist id |
| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 50) |

## Third-Party Requirements
To use this connector, this bundle requires some additional packages:
Expand Down
4 changes: 2 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade Notes

## Migrating from Version 1.x to Version 2.0.0
## Migrating from Version 2.x to Version 3.0.0

### Global Changes
- PHP8 return type declarations added: you may have to adjust your extensions accordingly
- Recommended folder structure by symfony adopted
9 changes: 5 additions & 4 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
namespace: DachcomBundle\Test
support_namespace: Support
actor: Tester
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
output: tests/_output
log: tests/_output/var/logs
data: tests/_data
support: tests/Support
bootstrap: _bootstrap.php
settings:
bootstrap: _bootstrap.php
memory_limit: -1
colors: true
params:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
}
},
"require": {
"dachcom-digital/social-data": "^2.0",
"dachcom-digital/social-data": "^3.0",
"google/apiclient": "^2.10"
},
"require-dev": {
"codeception/codeception": "^4.1",
"codeception/module-webdriver": "^1.4",
"codeception/module-symfony": "^1.6",
"codeception/codeception": "^5.0",
"codeception/module-symfony": "^3.1",
"codeception/module-webdriver": "^4.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"symplify/easy-coding-standard": "^9.0"
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/Resources/config/services.yml → config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ services:
tags:
- { name: form.type }

## Events

SocialData\Connector\Youtube\EventListener\Admin\AssetListener:
tags:
- { name: kernel.event_subscriber }
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
symfony:
container_xml_path: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml
constant_hassers: false
excludes_analyse: []
excludePaths: []
ignoreErrors:
-
message: "#^Unreachable statement \\- code above always terminates\\.$#" # google api returns non null return types
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$this->processConfiguration($configuration, $configs);

$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../Resources/config']));
$loader->load('services.yml');
$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../../config']));
$loader->load('services.yaml');
}
}
33 changes: 33 additions & 0 deletions src/EventListener/Admin/AssetListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace SocialData\Connector\Youtube\EventListener\Admin;

use Pimcore\Event\BundleManager\PathsEvent;
use Pimcore\Event\BundleManagerEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AssetListener implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
BundleManagerEvents::CSS_PATHS => 'addCssFiles',
BundleManagerEvents::JS_PATHS => 'addJsFiles',
];
}

public function addCssFiles(PathsEvent $event): void
{
$event->addPaths([
'/bundles/socialdatayoutubeconnector/css/admin.css'
]);
}

public function addJsFiles(PathsEvent $event): void
{
$event->addPaths([
'/bundles/socialdatayoutubeconnector/js/connector/youtube-connector.js',
'/bundles/socialdatayoutubeconnector/js/feed/youtube-feed.js',
]);
}
}
22 changes: 6 additions & 16 deletions src/SocialDataYoutubeConnectorBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,22 @@

namespace SocialData\Connector\Youtube;

use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class SocialDataYoutubeConnectorBundle extends AbstractPimcoreBundle
class SocialDataYoutubeConnectorBundle extends Bundle
{
use PackageVersionTrait;

public const PACKAGE_NAME = 'dachcom-digital/social-data-youtube-connector';

protected function getComposerPackageName(): string
public function getPath(): string
{
return self::PACKAGE_NAME;
return \dirname(__DIR__);
}

public function getCssPaths(): array
{
return [
'/bundles/socialdatayoutubeconnector/css/admin.css'
];
}

public function getJsPaths(): array
protected function getComposerPackageName(): string
{
return [
'/bundles/socialdatayoutubeconnector/js/connector/youtube-connector.js',
'/bundles/socialdatayoutubeconnector/js/feed/youtube-feed.js',
];
return self::PACKAGE_NAME;
}
}
12 changes: 12 additions & 0 deletions tests/Functional.suite.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
actor: FunctionalTester
modules:
enabled:
- \Dachcom\Codeception\Support\Helper\PimcoreCore:
connect_db: true
rebootable_client: true
- \Dachcom\Codeception\Support\Helper\PimcoreBundleCore:
run_installer: true
- \Dachcom\Codeception\Support\Helper\Browser\PhpBrowser:
depends: \Dachcom\Codeception\Support\Helper\PimcoreCore
- \Dachcom\Codeception\Support\Helper\PimcoreBackend
- \Dachcom\Codeception\Support\Helper\PimcoreUser
File renamed without changes.
8 changes: 8 additions & 0 deletions tests/Support/FunctionalTester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace DachcomBundle\Test\Support;

class FunctionalTester extends \Dachcom\Codeception\Support\FunctionalTester
{
use _generated\FunctionalTesterActions;
}
8 changes: 8 additions & 0 deletions tests/Support/UnitTester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace DachcomBundle\Test\Support;

class UnitTester extends \Dachcom\Codeception\Support\UnitTester
{
use _generated\UnitTesterActions;
}
Loading

0 comments on commit 7e7bce0

Please sign in to comment.