Skip to content

Commit

Permalink
style: phpcsエラー修正
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nakajima committed Oct 5, 2019
1 parent 9fec14c commit d45af33
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
8 changes: 5 additions & 3 deletions Model/PhotoAlbumPhoto.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection ALL */
<?php
/**
* PhotoAlbumPhoto Model
*
Expand All @@ -16,6 +16,8 @@

/**
* Summary for PhotoAlbumPhoto Model
*
* @noinspection ALL
*/
class PhotoAlbumPhoto extends PhotoAlbumsAppModel {

Expand Down Expand Up @@ -309,10 +311,10 @@ private function __regenerateDataForZip($data) {
/**
* 隠しファイル除外
*
* @param array $files
* @param array $files ファイル
* @return array
*/
private function __excludeHiddenFile(array $files) {
private function __excludeHiddenFile($files) {
$excludedFiles = [];
foreach ($files as $file) {
// "."はじまりのファイル(隠しファイル)は除外
Expand Down
60 changes: 47 additions & 13 deletions Test/Case/Model/PhotoAlbumPhoto/GetWorkflowConditionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,35 @@ class PhotoAlbumPhotoGetWorkflowConditionsTest extends NetCommonsCakeTestCase {
'plugin.photo_albums.photo_album_photo',
);

private $originPublishablePermission;
private $originEditablePermission;
private $originPermissions = [];
private $originCurrent =[];
/**
* 元の公開権限データを保持するための変数
*
* @var array
*/
private $__originPublishablePermission;

/**
/**
* 元の編集権限データを保持するための変数
*
* @var array
*/
private $__originEditablePermission;

/**
* 元の権限データを保持するための変数
*
* @var array
*/
private $__originPermissions = [];

/**
* 元のCurrentのデータ
*
* @var array
*/
private $__originCurrent = [];

/**
* setUp method
*
* @return void
Expand Down Expand Up @@ -98,7 +121,6 @@ public function testHasPhotoCreatable() {
$this->__setCurrent('Language.id', 99);
$this->__setCurrent('User.id', 88);


$expected = array (
array(
'OR' => array(
Expand Down Expand Up @@ -183,10 +205,10 @@ private function __permissionEditable() {
* @return void
*/
private function __restorePermission() {
Current::writePermission(null, 'content_publishable', $this->originPublishablePermission);
Current::writePermission(null, 'content_publishable', $this->originEditablePermission);
Current::writePermission(null, 'content_publishable', $this->__originPublishablePermission);
Current::writePermission(null, 'content_publishable', $this->__originEditablePermission);

foreach ($this->originPermissions as $permission => $permissionValue) {
foreach ($this->__originPermissions as $permission => $permissionValue) {
Current::writePermission(null, $permission, $permissionValue);
}
}
Expand All @@ -199,17 +221,29 @@ private function __restorePermission() {
* @return void
*/
private function __setPermission($permissionKey, $allow) {
$this->originPermissions[$permissionKey] = Current::permission($permissionKey);
$this->__originPermissions[$permissionKey] = Current::permission($permissionKey);
Current::writePermission(null, $permissionKey, $allow);
}

/**
* Currentにセットする
*
* @param string $key
* @param mixed $value
* @return void
*/
private function __setCurrent($key, $value) {
$this->originCurrent[$key] = Current::read($key);
Current::write($key, $value);
$this->__originCurrent[$key] = Current::read($key);
Current::write($key, $value);
}

/**
* Currentの中身をリストアする
*
* @return void
*/
private function __restoreCurrent() {
foreach ($this->originCurrent as $key => $value) {
foreach ($this->__originCurrent as $key => $value) {
Current::write($key, $value);
}
}
Expand Down
14 changes: 10 additions & 4 deletions Test/Case/Model/PhotoAlbumPhoto/PublishTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ class PhotoAlbumPhotoPublishTest extends NetCommonsCakeTestCase {
'plugin.users.user',
'plugin.workflow.workflow_comment',
);
private $originPermission;

/**
/**
* 元のCurrentのデータ
*
* @var array
*/
private $__originPermission;

/**
* setUp method
*
* @return void
Expand Down Expand Up @@ -120,7 +126,7 @@ public function testPublishException() {
* @return void
*/
private function __permissionPublishable() {
$this->originPermission = Current::permission('content_publishable');
$this->__originPermission = Current::permission('content_publishable');
Current::writePermission(null, 'content_publishable', true);
}

Expand All @@ -130,7 +136,7 @@ private function __permissionPublishable() {
* @return void
*/
private function __restorePermission() {
Current::writePermission(null, 'content_publishable', $this->originPermission);
Current::writePermission(null, 'content_publishable', $this->__originPermission);
}

}

0 comments on commit d45af33

Please sign in to comment.