diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c55f5d1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - '3*' + +name: create_release + +jobs: + build: + name: create_release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Slack Notification on Start + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-release + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: "#f0ad4e" + SLACK_MESSAGE: "Start Job" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: | + ${{ github.ref }} released. + draft: false + prerelease: false + + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Finish + uses: rtCamp/action-slack-notify@v2.2.0 + if: success() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-release + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: good + SLACK_MESSAGE: "Job Success" + + # テスト失敗時はこちらのステップが実行される + - name: Slack Notification on Failure + uses: rtCamp/action-slack-notify@v2.2.0 + if: failure() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: danger + SLACK_MESSAGE: "Job Failure" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..eb2068b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,170 @@ +on: + push: + branches: + - main + - master + - availability + pull_request: + branches: + - main + - master + - availability + +name: tests + +jobs: + setup: + name: setup + runs-on: ubuntu-latest + steps: + - name: Slack Notification on Start + uses: rtCamp/action-slack-notify@v2.2.0 + if: env.SLACK_WEBHOOK != '' + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: "#f0ad4e" + + tests: + name: tests + needs: setup + runs-on: ubuntu-latest + strategy: + matrix: + php: [ '7.1', '7.2', '7.3', '7.4' ] + mysql: [ '5.7', '8.0' ] + + env: + NC3_BUILD_DIR: "/opt/nc3" + NC3_DOCKER_DIR: "/opt/docker" + NC3_GIT_URL: "git://github.com/NetCommons3/NetCommons3.git" + NC3_GIT_BRANCH: "master" + PLUGIN_BUILD_DIR: ${{ github.workspace }} + PHP_VERSION: ${{ matrix.php }} + MYSQL_VERSION: ${{ matrix.mysql }} + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: cakephp_test + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - name: Fix up git URLs + run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + + - name: environment + run: | + echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" + echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}" + echo "PHP_VERSION=${PHP_VERSION}" + echo "MYSQL_VERSION=${MYSQL_VERSION}" + ls -al ${PLUGIN_BUILD_DIR} + + - name: docker-compose install + run: | + curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose + chmod +x ~/docker-compose + sudo mv ~/docker-compose /usr/local/bin/docker-compose + docker-compose --version + + - name: git clone nc3 + run: git clone -b ${NC3_GIT_BRANCH} ${NC3_GIT_URL} ${NC3_BUILD_DIR} + + - name: git clone nc3_docker + run: git clone https://github.com/NetCommons3/nc3app-docker.git ${NC3_DOCKER_DIR} + + - name: docker-compose start + run: | + cd ${NC3_DOCKER_DIR} + docker-compose up -d + docker-compose start + + - run: docker ps + + - name: check libraries + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/start-on-docker.sh + + - name: nc3 build + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/app-build.sh + + - name: phpcs (PHP CodeSniffer) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh + + - name: phpmd (PHP Mess Detector) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh + + - name: phpcpd (PHP Copy/Paste Detector) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh + + - name: gjslint (JavaScript Style Check) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh + + - name: phpdoc (PHP Documentor) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh + + - name: phpunit (PHP UnitTest) + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh + sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build + +# - name: push coveralls +# env: +# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# COVERALLS_FLAG_NAME: ${{ matrix.php }} +# run: | +# cd ${NC3_BUILD_DIR} +# ls -la ${NC3_BUILD_DIR} +# vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v + + - name: docker-compose remove + if: always() + run: | + cd ${NC3_DOCKER_DIR} + docker-compose rm -f + + # テスト失敗時はこちらのステップが実行される + - name: Slack Notification on Failure + uses: rtCamp/action-slack-notify@v2.2.0 + if: env.SLACK_WEBHOOK != '' && failure() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}(php${{ matrix.php }}, mysql${{ matrix.mysql }})" + SLACK_COLOR: danger + + teardown: + name: teardown + runs-on: ubuntu-latest + needs: tests + steps: + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Success + uses: rtCamp/action-slack-notify@v2.2.0 + if: env.SLACK_WEBHOOK != '' && success() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: good diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1b2842c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: php - -php: - - 7.0 - - 7.1 - - 7.2 - - 7.3.24 - - 7.4 - -sudo: false -dist: trusty - -env: - matrix: - - NETCOMMONS_VERSION=master DB=mysql - global: - - secure: "gfM6LvQaWwrQEtqTT3eXv4RNKXF1UBZWuGlO8DHe8X+S/ocpM5oMPBI7pYzCEheIsRhRccciBUFOaXVcI/bFkUCWsgEarimZBkCpTisKX7MwlFSuJX+rX8QNhGqXrn5aUZZ6K8F92aLipsi+j3gwccgebgTh7wHWYtfkLAxdLUw=" - - GIT_COMMITTER_NAME=kitalab - - GIT_COMMITTER_EMAIL=kitatsuji.yuto@withone.co.jp - - GIT_AUTHOR_NAME=kitalab - - GIT_AUTHOR_EMAIL=kitatsuji.yuto@withone.co.jp - -before_script: - - export NETCOMMONS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/NetCommons3 - - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR - - cd $NETCOMMONS_BUILD_DIR - - git checkout $NETCOMMONS_VERSION - - travis_wait . tools/build/plugins/cakephp/travis/pre.sh - - . tools/build/plugins/cakephp/travis/environment.sh - -script: - - . tools/build/plugins/cakephp/travis/main.sh - -after_script: - - . tools/build/plugins/cakephp/travis/post.sh - -notifications: - email: - recipients: - - netcommons3@googlegroups.com - on_success: never # default: change - on_failure: always # default: always diff --git a/Controller/CircularNoticesController.php b/Controller/CircularNoticesController.php index ec6f921..f7f9b8a 100644 --- a/Controller/CircularNoticesController.php +++ b/Controller/CircularNoticesController.php @@ -50,7 +50,7 @@ class CircularNoticesController extends CircularNoticesAppController { 'NetCommons.Permission' => array( //アクセスの権限 'allow' => array( - 'index,view,downloads' => 'content_readable', + //'index,view,downloads' => 'content_readable', 'add,edit,delete' => 'content_creatable', ), ), @@ -89,7 +89,7 @@ public function beforeFilter() { * index action * * @return void - * + * * 速度改善の修正に伴って発生したため抑制 * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -100,13 +100,13 @@ public function index() { } // コンテンツステータスの絞り込み値チェック - if (isset($this->params['named']['content_status']) + if (!empty($this->params['named']['content_status']) && ! $this->CircularNotice->existsContentStatus($this->params['named']['content_status'])) { return $this->throwBadRequest(); } // 回答状況の絞り込み値チェック - if (isset($this->params['named']['reply_status']) + if (!empty($this->params['named']['reply_status']) && ! $this->CircularNotice->existsReplyStatus($this->params['named']['reply_status'])) { return $this->throwBadRequest(); } @@ -139,7 +139,7 @@ public function index() { $currentSort = isset($this->params['named']['sort']) ? $this->params['named']['sort'] : 'CircularNoticeContent.modified'; - $currentDirection = isset($this->params['named']['sort']) + $currentDirection = isset($this->params['named']['direction']) ? $this->params['named']['direction'] : 'desc'; if (! isset($sortOptions[$currentSort . '.' . $currentDirection])) { @@ -347,6 +347,7 @@ public function add() { * edit action * * @return void + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function edit() { $userId = Current::read('User.id'); @@ -359,6 +360,12 @@ public function edit() { return $this->throwBadRequest(); } + // フレームから取得したCircularNoticeSetting.keyとコンテンツのcircular_notice_setting_keyが一致しない場合はBadRequest + $settingKey = $this->viewVars['circularNoticeSetting']['CircularNoticeSetting']['key'] ?? null; + if ($content['CircularNoticeContent']['circular_notice_setting_key'] !== $settingKey) { + return $this->throwBadRequest(); + } + if ($this->CircularNoticeContent->canEditWorkflowContent($content) === false) { return $this->throwBadRequest(); } @@ -506,9 +513,13 @@ public function download() { $csvFile->add($header); // 回答データ整形 + $choices = array(); + foreach ($content['CircularNoticeChoice'] as $choice) { + $choices[$choice['id']] = $choice; + } $content = $content['CircularNoticeContent']; foreach ($targetUsers as $targetUser) { - $answer = $this->__parseAnswer($content['reply_type'], $targetUser); + $answer = $this->__parseAnswer($content['reply_type'], $targetUser, $choices); $readDatetime = __d('circular_notices', 'Unread'); if ($targetUser['CircularNoticeTargetUser']['read_datetime']) { @@ -550,9 +561,10 @@ public function download() { * * @param string $replyType 回答種別 * @param array $targetUser 回答者 + * @param array $choices 選択肢情報 * @return null|string */ - private function __parseAnswer($replyType, $targetUser) { + private function __parseAnswer($replyType, $targetUser, $choices) { $answer = null; switch ($replyType) { case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_TEXT: @@ -562,6 +574,10 @@ private function __parseAnswer($replyType, $targetUser) { case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_MULTIPLE_SELECTION: $selectionValues = explode(CircularNoticeComponent::SELECTION_VALUES_DELIMITER, $targetUser['CircularNoticeTargetUser']['reply_selection_value']); + // 取り出したreply_selection_valueの値を選択肢のラベルに変換する + foreach ($selectionValues as &$selectVal) { + $selectVal = $choices[$selectVal]['value'] ?? ''; + } $answer = implode(__d('circular_notices', 'Answer separator'), $selectionValues); break; } diff --git a/Model/CircularNoticeContent.php b/Model/CircularNoticeContent.php index e47725f..c9c2131 100644 --- a/Model/CircularNoticeContent.php +++ b/Model/CircularNoticeContent.php @@ -375,7 +375,7 @@ public function getCircularNoticeContentsForPaginate($blockKey, $userId, $pagina ), ); - if (isset($paginatorParams['reply_status'])) { + if (!empty($paginatorParams['reply_status'])) { // 未回答の場合 if ($paginatorParams['reply_status'] == CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_NOT_REPLIED) { @@ -387,7 +387,7 @@ public function getCircularNoticeContentsForPaginate($blockKey, $userId, $pagina $conditions['CircularNoticeContent.reply_status'] = (int)$paginatorParams['reply_status']; } } - if (isset($paginatorParams['content_status'])) { + if (!empty($paginatorParams['content_status'])) { $conditions['CircularNoticeContent.content_status'] = (int)$paginatorParams['content_status']; } diff --git a/Model/CircularNoticeTargetUser.php b/Model/CircularNoticeTargetUser.php index 375f713..f9f0846 100644 --- a/Model/CircularNoticeTargetUser.php +++ b/Model/CircularNoticeTargetUser.php @@ -56,7 +56,6 @@ public function beforeValidate($options = array()) { * @return bool */ public function validateNotEmptyReplyValue($check) { - CakeLog::error(var_export($this->data['CircularNoticeTargetUser'], true)); if (! $this->data['CircularNoticeTargetUser']['reply_text_value'] && ! $this->data['CircularNoticeTargetUser']['reply_selection_value'] ) { diff --git a/README.md b/README.md index 9a2a20b..46a9136 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,6 @@ CircularNotices ======= -CircularNotices for NetComomns3 - -[![Build Status](https://travis-ci.org/NetCommons3/CircularNotices.svg?branch=master)](https://travis-ci.org/NetCommons3/CircularNotices) -[![Coverage Status](https://img.shields.io/coveralls/NetCommons3/CircularNotices.svg)](https://coveralls.io/r/NetCommons3/CircularNotices?branch=master) - -| dependencies | status | -| ------------ | ------ | -| composer.json | [![Dependency Status](https://www.versioneye.com/user/projects/54d34c21ee3836ec1000002a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54d34c21ee3836ec1000002a) | - - - +[![Tests Status](https://github.com/NetCommons3/CircularNotices/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/NetCommons3/CircularNotices/actions/workflows/tests.yml) +[![Coverage Status](https://coveralls.io/repos/NetCommons3/CircularNotices/badge.svg?branch=master)](https://coveralls.io/r/NetCommons3/CircularNotices?branch=master) +[![Stable Version](https://img.shields.io/packagist/v/netcommons/circular-notices.svg?label=stable)](https://packagist.org/packages/netcommons/circular-notices) diff --git a/Test/Case/AllCircularNoticesTest.php b/Test/Case/AllCircularNoticesTest.php index 2eb94dc..18e66eb 100644 --- a/Test/Case/AllCircularNoticesTest.php +++ b/Test/Case/AllCircularNoticesTest.php @@ -9,6 +9,8 @@ * @copyright Copyright 2014, NetCommons Project */ +App::uses('NetCommonsTestSuite', 'NetCommons.TestSuite'); + /** * CircularNotices All Test Case * @@ -25,7 +27,7 @@ class AllCircularNoticesTest extends CakeTestSuite { */ public static function suite() { $plugin = preg_replace('/^All([\w]+)Test$/', '$1', __CLASS__); - $suite = new CakeTestSuite(sprintf('All %s Plugin tests', $plugin)); + $suite = new NetCommonsTestSuite(sprintf('All %s Plugin tests', $plugin)); $suite->addTestDirectoryRecursive(CakePlugin::path($plugin) . 'Test' . DS . 'Case'); return $suite; } diff --git a/Test/Case/Controller/CircularNoticesController/EditTest.php b/Test/Case/Controller/CircularNoticesController/EditTest.php index 5c48253..0f52d19 100644 --- a/Test/Case/Controller/CircularNoticesController/EditTest.php +++ b/Test/Case/Controller/CircularNoticesController/EditTest.php @@ -93,6 +93,7 @@ public function dataProviderEdit() { $results[0] = array( 'urlOptions' => Hash::insert($data, 'frame_id', ''), 'assert' => null, + 'exception' => 'BadRequestException' ); $results[1] = array( 'urlOptions' => Hash::insert($data, 'key', 'A'), @@ -105,7 +106,8 @@ public function dataProviderEdit() { ); $results[3] = array( 'urlOptions' => Hash::insert($data, 'key', 'circular_notice_content_4'), - 'assert' => array('method' => 'assertNotEmpty'), + 'assert' => null, + 'exception' => 'BadRequestException' ); return $results; diff --git a/Test/Case/Controller/CircularNoticesController/ParseAnswerTest.php b/Test/Case/Controller/CircularNoticesController/ParseAnswerTest.php index 8741440..a458e11 100644 --- a/Test/Case/Controller/CircularNoticesController/ParseAnswerTest.php +++ b/Test/Case/Controller/CircularNoticesController/ParseAnswerTest.php @@ -65,6 +65,7 @@ public function dataProviderParseAnswer() { 'reply_text_value' => 'Lorem ipsum dolor sit amet' ), ), + 'choices' => array() ), 'assert' => 'Lorem ipsum dolor sit amet' ); @@ -78,8 +79,14 @@ public function dataProviderParseAnswer() { 'reply_selection_value' => '1|3', ), ), + 'choices' => array( + 1 => array('id' => 1, 'value' => 'AAA'), + 2 => array('id' => 2, 'value' => 'BBB'), + 3 => array('id' => 3, 'value' => 'CCC'), + 4 => array('id' => 4, 'value' => 'DDD') + ) ), - 'assert' => '1、3' + 'assert' => 'AAA、CCC' ); return $results; @@ -103,7 +110,8 @@ public function testParseAnswer($data, $assert, $exception = null) { $result = $method->invoke( $stub, $data['CircularNoticeContent']['reply_type'], - $data['CircularNoticeTargetUser'] + $data['CircularNoticeTargetUser'], + $data['choices'] ); $this->assertEquals($result, $assert); } diff --git a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticeFrameSettingsEditFormController.php b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticeFrameSettingsEditFormController.php index 72f92c6..6c4f6dd 100644 --- a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticeFrameSettingsEditFormController.php +++ b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticeFrameSettingsEditFormController.php @@ -27,6 +27,7 @@ class TestViewElementsCircularNoticeFrameSettingsEditFormController extends AppC public $helpers = array( 'Mails.MailsHtml', 'Mails.MailForm', + 'NetCommons.DisplayNumber', ); /** diff --git a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesSubjectEditFormController.php b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesSubjectEditFormController.php index d7ce550..6fd88fb 100644 --- a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesSubjectEditFormController.php +++ b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesSubjectEditFormController.php @@ -19,6 +19,15 @@ */ class TestViewElementsCircularNoticesSubjectEditFormController extends AppController { +/** + * use helpers + * + * @var array + */ + public $helpers = array( + 'NetCommons.TitleIcon', + ); + /** * subject_edit_form * diff --git a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesTargetEditFormController.php b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesTargetEditFormController.php index fa7fdb4..d6fa86a 100644 --- a/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesTargetEditFormController.php +++ b/Test/test_app/Plugin/TestCircularNotices/Controller/TestViewElementsCircularNoticesTargetEditFormController.php @@ -19,6 +19,15 @@ */ class TestViewElementsCircularNoticesTargetEditFormController extends AppController { +/** + * use helpers + * + * @var array + */ + public $helpers = array( + 'Groups.GroupUserList', + ); + /** * target_edit_form * diff --git a/VERSION.txt b/VERSION.txt index 4772543..86fb650 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.2 +3.3.7 diff --git a/View/CircularNotices/index.ctp b/View/CircularNotices/index.ctp index 1f7ea24..5451225 100644 --- a/View/CircularNotices/index.ctp +++ b/View/CircularNotices/index.ctp @@ -79,6 +79,15 @@ element('CircularNotices/status_label', array( 'circularNoticeContent' => $circularNoticeContent['CircularNoticeContent']) ); ?> + + + +
+ + + CircularNotice->displayDate($circularNoticeContent['CircularNoticeContent']['reply_deadline']); ?> + +
diff --git a/View/CircularNotices/view.ctp b/View/CircularNotices/view.ctp index 3cae1fd..9fbf2fa 100644 --- a/View/CircularNotices/view.ctp +++ b/View/CircularNotices/view.ctp @@ -24,6 +24,12 @@ ) ); ?> +
@@ -179,10 +185,8 @@ )); break; case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_SELECTION: - $selections = array(); $selected = ''; foreach ($circularNoticeChoice as $choice) : - $selections[$choice['id']] = $choice['value']; if ($choice['id'] === $myAnswer['CircularNoticeTargetUser']['reply_selection_value']) : $selected = $choice['id']; endif; @@ -197,11 +201,9 @@ )); break; case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_MULTIPLE_SELECTION: - $selections = array(); $selected = explode(CircularNoticeComponent::SELECTION_VALUES_DELIMITER, $myAnswer['CircularNoticeTargetUser']['reply_selection_value']); $selectedValue = array(); foreach ($circularNoticeChoice as $choices) : - $selections[$choices['id']] = $choices['value']; if (in_array($choices['id'], $selected, true)) : $selectedValue[] = $choices['value']; endif; @@ -331,7 +333,7 @@ $answer = null; switch ($circularNoticeContent['reply_type']) { case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_TEXT: - $answer = nl2br(h($circularNoticeTargetUser['CircularNoticeTargetUser']['reply_text_value'])); + $answer = $circularNoticeTargetUser['CircularNoticeTargetUser']['reply_text_value']; break; case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_SELECTION: case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_MULTIPLE_SELECTION: @@ -362,7 +364,7 @@ $this->NetCommonsHtml->handleLink($circularNoticeTargetUser, array('avatar' => true), array(), 'User'), array($readDatetime, array('class' => 'row-datetime')), array($replyDatetime, array('class' => 'row-datetime')), - array(h($answer), array('class' => 'circular-notices-reply-col circular-notices-word-break')), + array(nl2br(h($answer)), array('class' => 'circular-notices-reply-col circular-notices-word-break')), )); endforeach; ?> diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c0bacd0..1154cd3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,9 +3,6 @@ - - - app/Plugin/CircularNotices @@ -20,5 +17,6 @@ +