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

WIP: SS4 upgrade #111

Open
wants to merge 8 commits into
base: 2.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,

'binary_operator_spaces' => array(
'align_double_arrow' => false,
'align_equals' => false,
),
// 'blank_line_after_opening_tag' => true,
// 'blank_line_before_return' => true,
'braces' => array(
'allow_single_line_closure' => true,
),
// 'cast_spaces' => true,
// 'class_definition' => array('singleLine' => true),
'concat_space' => array('spacing' => 'one'),
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'include' => true,
'lowercase_cast' => true,
// 'native_function_casing' => true,
// 'new_with_braces' => true,
// 'no_blank_lines_after_class_opening' => true,
// 'no_blank_lines_after_phpdoc' => true,
// 'no_empty_comment' => true,
// 'no_empty_phpdoc' => true,
// 'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => array(
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
),
// 'no_leading_import_slash' => true,
// 'no_leading_namespace_whitespace' => true,
// 'no_mixed_echo_print' => array('use' => 'echo'),
'no_multiline_whitespace_around_double_arrow' => true,
// 'no_short_bool_cast' => true,
// 'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
// 'no_trailing_comma_in_list_call' => true,
// 'no_trailing_comma_in_singleline_array' => true,
// 'no_unneeded_control_parentheses' => true,
// 'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
// 'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
// 'php_unit_fqcn_annotation' => true,
// 'phpdoc_align' => true,
// 'phpdoc_annotation_without_dot' => true,
// 'phpdoc_indent' => true,
// 'phpdoc_inline_tag' => true,
// 'phpdoc_no_access' => true,
// 'phpdoc_no_alias_tag' => true,
// 'phpdoc_no_empty_return' => true,
// 'phpdoc_no_package' => true,
// 'phpdoc_no_useless_inheritdoc' => true,
// 'phpdoc_return_self_reference' => true,
// 'phpdoc_scalar' => true,
// 'phpdoc_separation' => true,
// 'phpdoc_single_line_var_spacing' => true,
// 'phpdoc_summary' => true,
// 'phpdoc_to_comment' => true,
// 'phpdoc_trim' => true,
// 'phpdoc_types' => true,
// 'phpdoc_var_without_name' => true,
// 'pre_increment' => true,
// 'return_type_declaration' => true,
// 'self_accessor' => true,
// 'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
// 'single_class_element_per_statement' => true,
// 'space_after_semicolon' => true,
// 'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
// 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
))
//->setIndent("\t")
->setLineEnding("\n")
;
63 changes: 63 additions & 0 deletions .upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
mappings:
SWS_CheckoutTest: SwipeStripe\Core\tests\SWS_CheckoutTest
SWS_OrderTest: SwipeStripe\Core\tests\SWS_OrderTest
SWS_CartTest: SwipeStripe\Core\tests\SWS_CartTest
SWS_Test: SwipeStripe\Core\tests\SWS_Test
SWS_ProductTest: SwipeStripe\Core\tests\SWS_ProductTest
SWS_AccountTest: SwipeStripe\Core\tests\SWS_AccountTest
CheckoutPage: SwipeStripe\Core\Customer\CheckoutPage
CheckoutPage_Controller: SwipeStripe\Core\Customer\CheckoutPageController
CartPage: SwipeStripe\Core\Customer\CartPage
CartPage_Controller: SwipeStripe\Core\Customer\CartPageController
Customer: SwipeStripe\Core\Customer\Customer
AccountPage: SwipeStripe\Core\Customer\AccountPage
AccountPage_Controller: SwipeStripe\Core\Customer\AccountPageController
Cart: SwipeStripe\Core\Customer\Cart
Price: SwipeStripe\Core\Product\Price
Attribute: SwipeStripe\Core\Product\Attribute
Attribute_OptionField: SwipeStripe\Core\Product\AttributeOptionField
Attribute_Default: SwipeStripe\Core\Product\AttributeDefault
Variation: SwipeStripe\Core\Product\Variation
Variation_Options: SwipeStripe\Core\Product\VariationOptions
Product: SwipeStripe\Core\Product\Product
Product_Controller: SwipeStripe\Core\Product\Product_Controller
Option: SwipeStripe\Core\Product\Option
Option_Default: SwipeStripe\Core\Product\OptionDefault
Order: SwipeStripe\Core\Order\Order
Order_Update: SwipeStripe\Core\Order\OrderUpdate
ItemOption: SwipeStripe\Core\Order\ItemOption
Modification: SwipeStripe\Core\Order\Modification
Item: SwipeStripe\Core\Order\Item
Payment_Extension: SwipeStripe\Core\Order\Payment_Extension
Payment_ProcessorExtension: SwipeStripe\Core\Order\PaymentProcessorExtension
ModificationField_Hidden: SwipeStripe\Core\Form\ModificationFieldHidden
ModificationField_Dropdown: SwipeStripe\Core\Form\ModificationFieldDropdown
CartForm: SwipeStripe\Core\Form\CartForm
CartForm_QuantityField: SwipeStripe\Core\Form\CartFormQuantityField
OrderForm: SwipeStripe\Core\Form\OrderForm
OrderForm_Validator: SwipeStripe\Core\Form\OrderFormValidator
OrderForm_ItemField: SwipeStripe\Core\Form\OrderFormItemField
ProductForm: SwipeStripe\Core\Form\ProductForm
ProductForm_Validator: SwipeStripe\Core\Form\ProductFormValidator
ProductForm_QuantityField: SwipeStripe\Core\Form\ProductFormQuantityField
RepayForm: SwipeStripe\Core\Form\RepayForm
OptionField: SwipeStripe\Core\Admin\OptionField
PriceField: SwipeStripe\Core\Admin\PriceField
ShopSearchContext_Order: SwipeStripe\Core\Admin\ShopSearchContext_Order
GridFieldDetailForm_HasManyItemRequest: SwipeStripe\Core\Admin\GridFieldDetailForm_HasManyItemRequest
ShopConfig: SwipeStripe\Core\Admin\ShopConfig
ShopSearchFilter_OptionSet: SwipeStripe\Core\Admin\ShopSearchFilterOptionSet
ShopSearchFilter_PublishedStatus: SwipeStripe\Core\Admin\ShopSearchFilterPublishedStatus
ShopAdmin: SwipeStripe\Core\Admin\ShopAdmin
ShopAdmin_EmailAdmin: SwipeStripe\Core\Admin\ShopAdminEmailAdmin
ShopAdmin_BaseCurrency: SwipeStripe\Core\Admin\ShopAdminBaseCurrency
ShopAdmin_Attribute: SwipeStripe\Core\Admin\ShopAdminAttribute
ShopAdmin_LeftAndMainExtension: SwipeStripe\Core\Admin\ShopAdminLeftAndMainExtension
GridFieldConfig_Basic: SwipeStripe\Core\Admin\GridFieldConfig_Basic
GridFieldConfig_BasicSortable: SwipeStripe\Core\Admin\GridFieldConfig_BasicSortable
GridFieldConfig_HasManyRelationEditor: SwipeStripe\Core\Admin\GridFieldConfig_HasManyRelationEditor
NotificationEmail: SwipeStripe\Core\Mails\NotificationEmail
ProcessedEmail: SwipeStripe\Core\Mails\ProcessedEmail
ReceiptEmail: SwipeStripe\Core\Mails\ReceiptEmail
RemoveDevOrdersTask: SwipeStripe\Core\tasks\RemoveDevOrdersTask
RemoveAbandonedCartsTask: SwipeStripe\Core\tasks\RemoveAbandonedCartsTask
5 changes: 5 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<?php

namespace SwipeStripe\Core;



44 changes: 22 additions & 22 deletions _config/swipestripe.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
name: SwipeStripe
---

Director:
SilverStripe\Control\Director:
rules:
'product//$ID!/$Action': 'Product_Controller'

product//$ID!/$Action: SwipeStripe\Core\Product\Product_Controller
Modifier:
Enabled:
-

ShopAdmin:
menu_icon: 'swipestripe/images/basket.png'

Security:
default_login_dest: 'account'

- null
SwipeStripe\Core\Admin\ShopAdmin:
menu_icon: swipestripe/images/basket.png
SilverStripe\Security\Security:
default_login_dest: account
Payment:
extensions:
- 'Payment_Extension'
extensions:
- SwipeStripe\Core\Order\Payment_Extension
PaymentProcessor:
extensions:
- 'Payment_ProcessorExtension'
LeftAndMain:
extensions:
- 'ShopAdmin_LeftAndMainExtension'
Page_Controller:
extensions:
- 'Cart'
extensions:
- SwipeStripe\Core\Order\PaymentProcessorExtension
SilverStripe\Admin\LeftAndMain:
extensions:
- SwipeStripe\Core\Admin\ShopAdminLeftAndMainExtension
PageController:
extensions:
- SwipeStripe\Core\Customer\Cart
SilverStripe\Core\Injector\Injector:
DataListFilter.OptionSet:
class: SwipeStripe\Core\Admin\ShopSearchFilterOptionSet
DataListFilter.PublishedStatus:
class: SwipeStripe\Core\Admin\ShopSearchFilterPublishedStatus
54 changes: 54 additions & 0 deletions code/Admin/GridFieldConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace SwipeStripe\Core\Admin;

use SilverStripe\Forms\GridField\GridFieldButtonRow;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\GridField\GridFieldFilterHeader;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldConfig;
use SwipeStripe\Core\Admin\GridFieldDetailForm_HasManyItemRequest;

/**
* Grid field basic configuration
*
* @todo Review the configs
*
* @author Frank Mullenger <[email protected]>
* @copyright Copyright (c) 2011, Frank Mullenger
* @package swipestripe
* @subpackage admin
*/
class GridFieldConfig_Basic extends GridFieldConfig
{
/**
* Constructor
*
* @param Int $itemsPerPage How many items on each page to display
*/
public function __construct($itemsPerPage = null)
{
$this->addComponent(new GridFieldButtonRow('before'));
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
$this->addComponent(new GridFieldToolbarHeader());
$this->addComponent($sort = new GridFieldSortableHeader());
$this->addComponent($filter = new GridFieldFilterHeader());
$this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldEditButton());
$this->addComponent(new GridFieldDeleteAction());
$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
$this->addComponent(new GridFieldDetailForm());

$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
}
}
58 changes: 58 additions & 0 deletions code/Admin/GridFieldConfig_BasicSortable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace SwipeStripe\Core\Admin;

use SilverStripe\Forms\GridField\GridFieldButtonRow;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\GridField\GridFieldFilterHeader;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldConfig;

/**
* Grid field basic sortable configuration
*
* @todo Review the configs
*
* @author Frank Mullenger <[email protected]>
* @copyright Copyright (c) 2011, Frank Mullenger
* @package swipestripe
* @subpackage admin
*/
class GridFieldConfig_BasicSortable extends GridFieldConfig
{
/**
* Constructor
*
* @param Int $itemsPerPage How many items on each page to display
*/
public function __construct($itemsPerPage = null)
{
$this->addComponent(new GridFieldButtonRow('before'));
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
$this->addComponent(new GridFieldToolbarHeader());
$this->addComponent($sort = new GridFieldSortableHeader());
$this->addComponent($filter = new GridFieldFilterHeader());
$this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldEditButton());
$this->addComponent(new GridFieldDeleteAction());
$this->addComponent(new GridFieldDetailForm());

if (class_exists('GridFieldSortableRows')) {
$this->addComponent(new GridFieldSortableRows('SortOrder'));
}

$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
$pagination->setThrowExceptionOnBadDataType(false);

$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
}
}
56 changes: 56 additions & 0 deletions code/Admin/GridFieldConfig_HasManyRelationEditor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace SwipeStripe\Core\Admin;

use SilverStripe\Forms\GridField\GridFieldButtonRow;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\GridField\GridFieldFilterHeader;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldConfig;
use SwipeStripe\Core\Admin\GridFieldDetailForm_HasManyItemRequest;

/**
* Grid field basic has many configuration
*
* @todo Review the configs
*
* @author Frank Mullenger <[email protected]>
* @copyright Copyright (c) 2011, Frank Mullenger
* @package swipestripe
* @subpackage admin
*/
class GridFieldConfig_HasManyRelationEditor extends GridFieldConfig
{
/**
* Constructor
*
* @param Int $itemsPerPage How many items on each page to display
*/
public function __construct($itemsPerPage = null)
{
$this->addComponent(new GridFieldButtonRow('before'));
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
$this->addComponent(new GridFieldToolbarHeader());
$this->addComponent($sort = new GridFieldSortableHeader());
$this->addComponent($filter = new GridFieldFilterHeader());
$this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldEditButton());
$this->addComponent(new GridFieldDeleteAction());
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));

$detailForm = new GridFieldDetailForm();
$detailForm->setItemRequestClass(GridFieldDetailForm_HasManyItemRequest::class);
$this->addComponent($detailForm);

$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
}
}
Loading