-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TheDMSGroup/ENG-165
[Eng-165] US State Normalization
- Loading branch information
Showing
11 changed files
with
239 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Standard .travis.yml for a Mautic plugin. Adjust env variables as needed. | ||
env: | ||
global: | ||
# The exact plugin folder/bundle name. | ||
- "MAUTIC_PLUGIN=MauticUSStateNormalizerBundle" | ||
|
||
dist: precise | ||
|
||
language: php | ||
|
||
services: | ||
- mysql | ||
|
||
php: | ||
- 5.6.19 | ||
- 7.0 | ||
- 7.1 | ||
|
||
before_install: | ||
|
||
# Create mautictest database. | ||
- mysql -e 'CREATE DATABASE mautictest;' | ||
|
||
# Turn off XDebug. | ||
- phpenv config-rm xdebug.ini || return | ||
|
||
# Install dependencies in parallel. | ||
- travis_retry composer global require hirak/prestissimo | ||
|
||
# Set to test environment for Symfony's commands in post install commands. | ||
- export SYMFONY_ENV="test" | ||
|
||
# Install PHPSTAN for PHP 7+ | ||
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.6" ]]; then composer global require phpstan/phpstan-shim:0.8.5; fi | ||
|
||
# Clone the latest core release. | ||
- git clone -b master --single-branch --depth 1 https://github.com/mautic/mautic.git /tmp/mautic | ||
|
||
# Combine core with our plugin. | ||
- mkdir -p /tmp/mautic/plugins/$MAUTIC_PLUGIN | ||
- rsync -r --delete-after --quiet $TRAVIS_BUILD_DIR/ /tmp/mautic/plugins/$MAUTIC_PLUGIN | ||
- rsync -r --delete-after --quiet /tmp/mautic/ $TRAVIS_BUILD_DIR/ | ||
|
||
install: | ||
|
||
# Install core dependencies. | ||
- composer install | ||
|
||
# Install plugin dependencies (if any). | ||
- composer require wikimedia/composer-merge-plugin | ||
- composer config extra.merge-plugin.include plugins/$MAUTIC_PLUGIN/composer.json | ||
|
||
script: | ||
|
||
# Run PHPUnit including core tests to find potential BC breaks. | ||
- bin/phpunit -d memory_limit=2048M --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist --fail-on-warning | ||
|
||
# Run PHPSTAN analysis for PHP 7+ only in the scope of this plugin. | ||
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.6" ]]; then ~/.composer/vendor/phpstan/phpstan-shim/phpstan.phar analyse plugins/$MAUTIC_PLUGIN; fi | ||
|
||
# Check code standards for PHP 7.1 only in the scope of this plugin. | ||
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.1" ]]; then bin/php-cs-fixer fix -v --dry-run --diff plugins/$MAUTIC_PLUGIN; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: nbush | ||
* Date: 4/25/18 | ||
* Time: 9:00 AM. | ||
*/ | ||
|
||
namespace MauticPlugin\MauticUSStateNormalizerBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class USStateNormalizerPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$formFieldHelper = $container->getDefinition('mautic.helper.form.field_helper'); | ||
$formFieldHelper->setClass('\MauticPlugin\MauticUSStateNormalizerBundle\Helper\USStateFormFieldHelper'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: nbush | ||
* Date: 4/25/18 | ||
* Time: 9:06 AM. | ||
*/ | ||
|
||
namespace MauticPlugin\MauticUSStateNormalizerBundle\Helper; | ||
|
||
use Mautic\LeadBundle\Helper\FormFieldHelper as OriginalHelper; | ||
|
||
class USStateFormFieldHelper extends OriginalHelper | ||
{ | ||
public static function getRegionChoices() | ||
{ | ||
$helper = new USStateMapHelper(); | ||
$choices = parent::getRegionChoices(); | ||
$choices['United States'] = $helper::getStateOptions(); | ||
|
||
return $choices; | ||
} | ||
} |
Oops, something went wrong.