Skip to content

Commit

Permalink
Merge pull request #8 from EC-CUBE/refactor
Browse files Browse the repository at this point in the history
リファクタリング
  • Loading branch information
ryo-endo authored Aug 31, 2016
2 parents 6e53d29 + ac3b777 commit 5e44bdf
Show file tree
Hide file tree
Showing 18 changed files with 475 additions and 123 deletions.
66 changes: 66 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
language: php

sudo: false

cache:
directories:
- $HOME/.composer/cache
- /home/travis/.composer/cache

php:
- 5.3
- 5.4
- 5.5
- 5.6
# - 7.0

env:
# plugin code
global:
PLUGIN_CODE=CategoryContent
matrix:
# # ec-cube master
# - ECCUBE_VERSION=master DB=mysql USER=root DBNAME=myapp_test DBPASS=' ' DBUSER=root
# - ECCUBE_VERSION=master DB=pgsql USER=postgres DBNAME=myapp_test DBPASS=password DBUSER=postgres
- ECCUBE_VERSION=3.0.8 DB=mysql USER=root DBNAME=myapp_test DBPASS=' ' DBUSER=root
- ECCUBE_VERSION=3.0.8 DB=pgsql USER=postgres DBNAME=myapp_test DBPASS=password DBUSER=postgres
- ECCUBE_VERSION=3.0.9 DB=mysql USER=root DBNAME=myapp_test DBPASS=' ' DBUSER=root
- ECCUBE_VERSION=3.0.9 DB=pgsql USER=postgres DBNAME=myapp_test DBPASS=password DBUSER=postgres
- ECCUBE_VERSION=3.0.10 DB=mysql USER=root DBNAME=myapp_test DBPASS=' ' DBUSER=root
- ECCUBE_VERSION=3.0.10 DB=pgsql USER=postgres DBNAME=myapp_test DBPASS=password DBUSER=postgres

matrix:
fast_finish: true

before_script:
# archive plugin
- tar cvzf ${HOME}/${PLUGIN_CODE}.tar.gz ./*
# clone ec-cube
- git clone https://github.com/EC-CUBE/ec-cube.git
- cd ec-cube
# checkout version
- sh -c "if [ ! '${ECCUBE_VERSION}' = 'master' ]; then git checkout -b ${ECCUBE_VERSION} refs/tags/${ECCUBE_VERSION}; fi"
# update composer
- composer selfupdate
- composer global require hirak/prestissimo
- composer install --dev --no-interaction -o
# install ec-cube
- sh eccube_install.sh ${DB} none
# install plugin
- php app/console plugin:develop install --path=${HOME}/${PLUGIN_CODE}.tar.gz
# enable plugin
- php app/console plugin:develop enable --code=${PLUGIN_CODE}

script:
# exec phpunit on ec-cube
- phpunit app/Plugin/${PLUGIN_CODE}/Tests

after_script:
# disable plugin
- php app/console plugin:develop disable --code=${PLUGIN_CODE}
# uninstall plugin
- php app/console plugin:develop uninstall --code=${PLUGIN_CODE}
# re install plugin
- php app/console plugin:develop install --code=${PLUGIN_CODE}
# re enable plugin
- php app/console plugin:develop enable --code=${PLUGIN_CODE}
20 changes: 10 additions & 10 deletions CategoryContentEvent.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent;

Expand Down Expand Up @@ -89,7 +89,7 @@ public function onRenderProductList(TemplateEvent $event)
*
* @param EventArgs $event
*/
public function onFormInitializeAdminProductCategory(EventArgs $event)
public function onAdminProductCategoryIndexInit(EventArgs $event)
{
/** @var Category $target_category */
$TargetCategory = $event->getArgument('TargetCategory');
Expand Down Expand Up @@ -132,7 +132,7 @@ public function onFormInitializeAdminProductCategory(EventArgs $event)
*
* @param EventArgs $event
*/
public function onAdminProductCategoryEditComplete(EventArgs $event)
public function onAdminProductCategoryIndexComplete(EventArgs $event)
{
/** @var Application $app */
$app = $this->app;
Expand Down
20 changes: 11 additions & 9 deletions CategoryContentLegacyEvent.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent;

Expand All @@ -17,6 +17,8 @@

/**
* Hook point implementation for v3.0.0 - 3.0.8.
*
* @deprecated for since v3.0.0, to be removed in 3.1.
*/
class CategoryContentLegacyEvent
{
Expand Down Expand Up @@ -108,7 +110,7 @@ public function onRenderAdminProductCategoryEditBefore(FilterResponseEvent $even
$form->handleRequest($request);

$twig = $app->renderView(
'CategoryContent/Resource/template/Admin/category.twig',
'CategoryContent/Resource/template/admin/category.twig',
array('form' => $form->createView())
);

Expand Down
16 changes: 8 additions & 8 deletions Entity/CategoryContent.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent\Entity;

Expand Down
28 changes: 14 additions & 14 deletions Form/Extension/CategoryContentExtension.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;

/**
* Class CategoryContentExtension
*
* @package Plugin\CategoryContent\Form\Extension
* @deprecated for since v3.0.0, to be removed in 3.1.
*/
class CategoryContentExtension extends AbstractTypeExtension
{
public function buildForm(FormBuilderInterface $builder, array $options)
Expand All @@ -31,10 +35,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
);
}

public function buildView(FormView $view, FormInterface $form, array $options)
{
}

public function getExtendedType()
{
return 'admin_category';
Expand Down
File renamed without changes.
27 changes: 0 additions & 27 deletions Migration/Version20150706204400.php

This file was deleted.

22 changes: 11 additions & 11 deletions PluginManager.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent;

Expand All @@ -18,17 +18,17 @@ class PluginManager extends AbstractPluginManager

public function install($config, $app)
{
$this->migrationSchema($app, __DIR__.'/Migration', $config['code']);

}

public function uninstall($config, $app)
{
$this->migrationSchema($app, __DIR__.'/Migration', $config['code'], 0);
$this->migrationSchema($app, __DIR__.'/Resource/doctrine/migration', $config['code'], 0);
}

public function enable($config, $app)
{

$this->migrationSchema($app, __DIR__.'/Resource/doctrine/migration', $config['code']);
}

public function disable($config, $app)
Expand Down
16 changes: 8 additions & 8 deletions Repository/CategoryContentRepository.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\CategoryContent\Repository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Plugin\CategoryContent\Entity\CategoryContent:
id:
type: integer
nullable: false
unsigned: false
options:
unsigned: false
id: true
column: category_id
generator:
Expand Down
Loading

0 comments on commit 5e44bdf

Please sign in to comment.