Skip to content

Commit

Permalink
Refactor/ss4 (#309)
Browse files Browse the repository at this point in the history
* namespacing

* class mapping

* tests overhaul

* CI setup

* phpcs cleanup
  • Loading branch information
jsirish authored Mar 6, 2018
1 parent f8f77e9 commit d2a4abb
Show file tree
Hide file tree
Showing 60 changed files with 3,258 additions and 2,130 deletions.
10 changes: 8 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tools:
fixers: []
enabled: false
filter:
paths: [tests/*,code/*]
paths: [tests/*,src/*]
excluded_paths: []
coding_style:
php:
Expand All @@ -27,5 +27,11 @@ checks:
code_rating: true
duplication: true

build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]

filter:
paths: [tests/*,code/*]
paths: [tests/*,src/*]
59 changes: 20 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,34 @@
language: php

sudo: false

addons:
apt:
packages:
- tidy

before_install:
- pip install --user codecov

env:
global:
- DB=MYSQL CORE_RELEASE=3.4
- COVERAGE=0
- MODULE_PATH=foxystripe
- COMPOSER_ROOT_VERSION=4.0.x-dev
- CODECOV_TOKEN=
- SCRUT_TOKEN=

matrix:
include:
- php: 5.6
env: DB=PGSQL
- php: 5.6
env: DB=SQLITE
- php: 5.6
env: COVERAGE=1
- php: 7.0
env: CORE_RELEASE=master
allow_failures:
- php: 7.0
env: CORE_RELEASE=master

env: DB=MYSQL PHPUNIT_TEST=1 PHPCS_TEST=1
- php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
- php: 5.6
env: DB=MYSQL PHPUNIT_TEST=1

before_script:
# Init PHP
- phpenv rehash
- composer self-update || true
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss
- phpenv config-rm xdebug.ini
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

script:
# Execute tests with no coverage. This is the fastest option
- "if [ \"$COVERAGE\" = \"0\" ]; then vendor/bin/phpunit $MODULE_PATH/tests/; fi"

# Execute tests with coverage. Do this for a small
- "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover $MODULE_PATH/tests/; fi"
# Install composer dependencies
- composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2
- composer update --no-suggest --prefer-dist

after_script:
- "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi"
- cd ~/build/$TRAVIS_REPO_SLUG
- wget https://scrutinizer-ci.com/ocular.phar
- "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov && travis_retry php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"
script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -t $CODECOV_TOKEN && travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml; fi
2 changes: 1 addition & 1 deletion _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* FoxyStripe config - Change password encryption to something compatible with FoxyCart
*/

Config::inst()->update('Security', 'password_encryption_algorithm', 'sha1_v2.4');
//Config::inst()->update('Security', 'password_encryption_algorithm', 'sha1_v2.4');
18 changes: 9 additions & 9 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
Name: foxystripeconfig
---
SiteConfig:
SilverStripe\SiteConfig\SiteConfig:
extensions:
- FoxyStripeSiteConfig
Member:
- Dynamic\FoxyStripe\ORM\FoxyStripeSiteConfig
SilverStripe\Security\Member:
extensions:
- CustomerExtension
- Dynamic\FoxyStripe\ORM\CustomerExtension
Page:
extensions:
- FoxyStripePageExtension
DateField:
- Dynamic\FoxyStripe\ORM\FoxyStripePageExtension
SilverStripe\Forms\DateField:
default_config:
showcalendar: true
FormField:
SilverStripe\Forms\FormField:
extensions:
- FoxyStripeProductFormFieldExtension
Injector:
- Dynamic\FoxyStripe\ORM\FoxyStripeProductFormFieldExtension
SilverStripe\Core\Injector\Injector:
TimeZoneData:
properties:
format: '%Region/%Name'
2 changes: 1 addition & 1 deletion _config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ After: framework/routes#coreroutes
---
Director:
rules:
'foxystripe//$Action/$ID/$Name': 'FoxyStripe_Controller'
'foxystripe//$Action/$ID/$Name': 'FoxyStripeController'
28 changes: 0 additions & 28 deletions code/admin/OrderAdmin.php

This file was deleted.

92 changes: 0 additions & 92 deletions code/controllers/FoxyStripe_Controller.php

This file was deleted.

34 changes: 0 additions & 34 deletions code/extensions/CustomerExtension.php

This file was deleted.

10 changes: 0 additions & 10 deletions code/extensions/FoxyStripePageExtension.php

This file was deleted.

Loading

0 comments on commit d2a4abb

Please sign in to comment.