Skip to content

Commit

Permalink
Merge pull request #335 from hungtrinh/on-test-zend-ldap
Browse files Browse the repository at this point in the history
[Github action] - On test zend ldap
  • Loading branch information
glensc committed Mar 10, 2023
2 parents 4bd8f78 + 93adc40 commit 26aaf16
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 76 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/lint.yml

This file was deleted.

48 changes: 44 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ jobs:
TESTS_ZEND_CACHE_LIBMEMCACHED_ENABLED: true
TESTS_ZEND_CACHE_LIBMEMCACHED_HOST: 127.0.0.1
TESTS_ZEND_CACHE_LIBMEMCACHED_PORT: 11211

# https://hub.docker.com/r/bitnami/openldap
LDAP_ROOT: "dc=example,dc=com"
LDAP_ALLOW_ANON_BINDING: false
LDAP_SKIP_DEFAULT_TREE: "yes"
LDAP_ADMIN_USERNAME: "admin"
LDAP_ADMIN_PASSWORD: "insecure"
LDAP_CONFIG_ADMIN_USERNAME: "admin"
LDAP_CONFIG_ADMIN_PASSWORD: "configpassword"
TESTS_ZEND_LDAP_ONLINE_ENABLED: true
TESTS_ZEND_AUTH_ADAPTER_LDAP_ONLINE_ENABLED: true

LOCALES: "fr_FR@euro fr_FR fr_BE.UTF-8 de en_US"
services:
memcache:
Expand Down Expand Up @@ -69,6 +81,20 @@ jobs:
--health-timeout 5s
--health-retries 5
openldap:
image: bitnami/openldap:2.5
ports:
- 1389:1389
env:
LDAP_ROOT: ${{ env.LDAP_ROOT }}
LDAP_ALLOW_ANON_BINDING: ${{ env.LDAP_ALLOW_ANON_BINDING }}
LDAP_SKIP_DEFAULT_TREE: ${{ env.LDAP_SKIP_DEFAULT_TREE }}
LDAP_ADMIN_USERNAME: ${{ env.LDAP_ADMIN_USERNAME }}
LDAP_ADMIN_PASSWORD: ${{ env.LDAP_ADMIN_PASSWORD }}
LDAP_CONFIG_ADMIN_ENABLED: "yes"
LDAP_CONFIG_ADMIN_USERNAME: ${{ env.LDAP_CONFIG_ADMIN_USERNAME }}
LDAP_CONFIG_ADMIN_PASSWORD: ${{ env.LDAP_CONFIG_ADMIN_PASSWORD }}

strategy:
fail-fast: false
matrix:
Expand All @@ -94,16 +120,30 @@ jobs:
- name: Provider config base on env for intergrate test
run: cp tests/TestConfiguration.env.php tests/TestConfiguration.php



- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpunit:9
tools: cs2pr
extensions: memcached, memcache
ini-values: ${{ env.PHP_INI_VALUES }}
env:
# https://github.com/shivammathur/setup-php/issues/407#issuecomment-773675741
fail-fast: true

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Lint PHP source files
run: |
bin/parallel-lint --exclude vendor --exclude tests/Zend/Loader/_files/ParseError.php . --checkstyle | cs2pr
- name: Setup LDAP
run: |
sudo apt-get install -y libnss-ldap libpam-ldap ldap-utils
tests/resources/openldap/docker-entrypoint-initdb.d/init.sh
- name: "Run tests on PHP ${{ matrix.php-version }} (Experimental: ${{ matrix.experimental }})"
run: phpunit -c tests/phpunit.xml
run: bin/phpunit -c tests/phpunit.xml
continue-on-error: ${{ matrix.experimental }}
28 changes: 15 additions & 13 deletions tests/TestConfiguration.env.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,23 @@
* ALT_DN: CN=Alice Baker,OU=Sales,DC=foo,DC=net
* ALT_PASSWORD: apass
*/
defined('TESTS_ZEND_LDAP_HOST') || define('TESTS_ZEND_LDAP_HOST', getenv('TESTS_ZEND_LDAP_HOST') ?: 'localhost');
//defined('TESTS_ZEND_LDAP_PORT') || define('TESTS_ZEND_LDAP_PORT', getenv('TESTS_ZEND_LDAP_PORT') ?: 389);
defined('TESTS_ZEND_LDAP_USE_START_TLS') || define('TESTS_ZEND_LDAP_USE_START_TLS', getenv('TESTS_ZEND_LDAP_USE_START_TLS') ?: true);
//defined('TESTS_ZEND_LDAP_USE_SSL') || define('TESTS_ZEND_LDAP_USE_SSL', getenv('TESTS_ZEND_LDAP_USE_SSL') ?: false);
defined('TESTS_ZEND_LDAP_USERNAME') || define('TESTS_ZEND_LDAP_USERNAME', getenv('TESTS_ZEND_LDAP_USERNAME') ?: 'CN=someUser,DC=example,DC=com');
defined('TESTS_ZEND_LDAP_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', getenv('TESTS_ZEND_LDAP_PRINCIPAL_NAME') ?: 'someUser@example.com');
defined('TESTS_ZEND_LDAP_PASSWORD') || define('TESTS_ZEND_LDAP_PASSWORD', getenv('TESTS_ZEND_LDAP_PASSWORD') ?: null);
defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') || define('TESTS_ZEND_LDAP_BIND_REQUIRES_DN', getenv('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') ?: true);
defined('TESTS_ZEND_LDAP_BASE_DN') || define('TESTS_ZEND_LDAP_BASE_DN', getenv('TESTS_ZEND_LDAP_BASE_DN') ?: 'OU=Sales,DC=example,DC=com');
//defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') || define('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT', getenv('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') ?: '(&(objectClass=posixAccount)(uid=%s))');
defined('TESTS_ZEND_LDAP_HOST') || define('TESTS_ZEND_LDAP_HOST', getenv('TESTS_GENERATE_REPORT') ?: 'localhost');
defined('TESTS_ZEND_LDAP_PORT') || define('TESTS_ZEND_LDAP_PORT', getenv('TESTS_ZEND_LDAP_PORT') ?: 1389);
defined('TESTS_ZEND_LDAP_USE_START_TLS') || define('TESTS_ZEND_LDAP_USE_START_TLS', getenv('TESTS_ZEND_LDAP_USE_START_TLS') ?: false);
defined('TESTS_ZEND_LDAP_USE_SSL') || define('TESTS_ZEND_LDAP_USE_SSL', getenv('TESTS_ZEND_LDAP_USE_SSL') ?: false);
defined('TESTS_ZEND_LDAP_USERNAME') || define('TESTS_ZEND_LDAP_USERNAME', getenv('TESTS_ZEND_LDAP_USERNAME') ?: 'cn=admin,dc=example,dc=com');
defined('TESTS_ZEND_LDAP_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', getenv('TESTS_ZEND_LDAP_PRINCIPAL_NAME') ?: 'admin@example.com');
defined('TESTS_ZEND_LDAP_PASSWORD') || define('TESTS_ZEND_LDAP_PASSWORD', getenv('TESTS_ZEND_LDAP_PASSWORD') ?: 'insecure');
defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') || define('TESTS_ZEND_LDAP_BIND_REQUIRES_DN', getenv('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') ?: 'true');
defined('TESTS_ZEND_LDAP_BASE_DN') || define('TESTS_ZEND_LDAP_BASE_DN', getenv('TESTS_ZEND_LDAP_BASE_DN') ?: 'dc=example,dc=com');
defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') || define('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT', getenv('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') ?: '(&(objectClass=account)(uid=%s))');
defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME', getenv('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME') ?: 'example.com');
defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT', getenv('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT') ?: 'EXAMPLE');
defined('TESTS_ZEND_LDAP_ALT_USERNAME') || define('TESTS_ZEND_LDAP_ALT_USERNAME', getenv('TESTS_ZEND_LDAP_ALT_USERNAME') ?: 'anotherUser');
defined('TESTS_ZEND_LDAP_ALT_DN') || define('TESTS_ZEND_LDAP_ALT_DN', getenv('TESTS_ZEND_LDAP_ALT_DN') ?: 'CN=Another User,OU=Sales,DC=example,DC=com');
defined('TESTS_ZEND_LDAP_ALT_PASSWORD') || define('TESTS_ZEND_LDAP_ALT_PASSWORD', getenv('TESTS_ZEND_LDAP_ALT_PASSWORD') ?: null);
defined('TESTS_ZEND_LDAP_ALT_USERNAME') || define('TESTS_ZEND_LDAP_ALT_USERNAME', getenv('TESTS_ZEND_LDAP_ALT_USERNAME') ?: 'user1');
defined('TESTS_ZEND_LDAP_ALT_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_ALT_PRINCIPAL_NAME', getenv('TESTS_ZEND_LDAP_ALT_PRINCIPAL_NAME') ?: 'user1@example.com');
defined('TESTS_ZEND_LDAP_ALT_DN') || define('TESTS_ZEND_LDAP_ALT_DN', getenv('TESTS_ZEND_LDAP_ALT_DN') ?: 'uid=user1,dc=example,dc=com');
defined('TESTS_ZEND_LDAP_ALT_PASSWORD') || define('TESTS_ZEND_LDAP_ALT_PASSWORD', getenv('TESTS_ZEND_LDAP_ALT_PASSWORD') ?: 'user1');
defined('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE') || define('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE', getenv('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE') ?: 'ou=test,dc=example,dc=com');

/**
* Zend_Locale tests
Expand Down

0 comments on commit 26aaf16

Please sign in to comment.