{"action":"created","comment":{"url":"https://api.github.com/repos/baserproject/basercms/pulls/comments/90172077","pull_request_review_id":10694065,"id":90172077,"diff_hunk":"@@ -144,4 +161,183 @@ public function isSiteRelatedDataProvider() {\n \t\t];\n \t}\n \n-}\n\\ No newline at end of file\n+/**\n+ * アクションが利用可能かどうか確認する\n+ * isActionAvailable\n+ *\n+ * @param string $type コンテンツタイプ\n+ * @param string $action アクション\n+ * @param string $entityId コンテンツを特定するID\n+ * @return bool\n+ * @dataProvider isActionAvailableDataProvider\n+ */\n+\tpublic function testIsActionAvailable($type, $action, $entityId, $userGroup, $expect) {\n+//\t$user = BcUtil::loginUser('admin');\n+//\t$url = $this->settings[$type]['url'][$action] . '/' . $entityId;\n+//\treturn $this->_Permission->check($url, $user['user_group_id']);\n+\t\t//$this->BcContents->settings = $this->loadFixtures('ContentBcContentsHelper');\n+\t\t$_SESSION['Auth'][BcUtil::authSessionKey('admin')]['user_group_id'] = $userGroup;\n+\t\tApp::uses('BcContentsComponent', 'Controller/Component');\n+\t\t$BcContentsComponent = new BcContentsComponent(new ComponentCollection());\n+\t\t$BcContentsComponent->setupAdmin();\n+\t\t$View = new BcAppView();\n+\t\t$View->set('contentsSettings', $BcContentsComponent->settings['items']);\n+\t\t$View->helpers = array('BcContents');\n+\t\t$View->loadHelpers();\n+\t\t$View->BcContents->setup();\n+//\t\tprint_r($View->BcContents->settings);\n+\t\t$result = $View->BcContents->isActionAvailable($type, $action, $entityId);\n+\t\t$this->assertEquals($expect, $result);\n+\t}\n+\n+\tpublic function isActionAvailableDataProvider() {\n+\t\treturn [\n+\t\t\t// 管理ユーザー\n+\t\t\t['Default', 'admin_index', 1, 1, false], // 存在しないアクション\n+\t\t\t['ContentFolder', 'icon', 1, 1, true], // 存在するアクション\n+\t\t\t['ContentFolder', 'add', 1, 1, true], // 存在するアクション\n+\t\t\t['ContentFolder', 'edit', 1, 1, true], // 存在するアクション\n+\t\t\t['ContentFolder', 'delete', 1, 1, true], // 存在するアクション\n+\t\t\t['ContentAlias', 'icon', 1, 1, true], // 存在するアクション\n+\t\t\t['BlogContent', 'manage', 1, 1, true], // 存在するアクション\n+\t\t\t['MailContent', 'manage', 1, 1, true], // 存在するアクション\n+\t\t\t['Page', 'copy', 1, 1, true], // 存在するアクション\n+\t\t\t// 運営ユーザー\n+\t\t\t['ContentFolder', 'hoge', 2, 2, false], // 存在しないアクション\n+\t\t\t['Page', 'add', 2, 2, true], // 存在するアクション（権限あり）\n+\t\t\t['Page', 'edit', 2, 2, true], // 存在するアクション（権限あり）\n+\t\t\t['Page', 'delete', 1, 2, true], // 存在するアクション（権限あり）\n+\t\t\t['ContentFolder', 'edit', 1, 2, false], // 存在するアクション（権限なし）\n+\t\t\t['ContentAlias', 'add', 1, 2, false], // 存在するアクション（権限なし）\n+\t\t\t['ContentLink', 'add', 1, 2, false], // 存在するアクション（権限なし）\n+\t\t\t['BlogContent', 'add', 1, 2, false], // 存在するアクション（権限なし）\n+\t\t\t['MailContent', 'edit', 2, 2, false], // 存在するアクション（権限なし）\n+\t\t];\n+\t}\n+\n+/**\n+ * コンテンツIDよりURLを取得する\n+ * getUrlById\n+ *\n+ * @param $id\n+ * @return string\n+ * @dataProvider getUrlByIdDataProvider\n+ */\n+\tpublic function testGetUrlById($id, $full, $expect) {\n+\t\t$this->markTestIncomplete('このメソッドは、モデルをラッピングしているメソッドの為スキップします。');\n+//\t\t$data = $this->find('first', ['conditions' => ['Content.id' => $id]]);\n+//\t\treturn $this->getUrl($data['Content']['url'], $full, $data['Site']['use_subdomain']);\n+\t\t$result = $this->BcContents->getUrlById($id, $full);\n+//\t\tvar_dump($result);\n+//\t\tvar_dump($expect);\n+\t\t$this->assertEquals($expect, $result);\n+\t}\n+\n+\tpublic function getUrlByIdDataProvider() {\n+\t\treturn array(\n+\t\t\tarray(1, false, '/'),\n+\t\t\tarray(1, true, 'http://localhost/'),\n+\t\t\tarray(2, false, '/m/'),\n+            array(2, true, 'http://localhost/m/'),\n+\t\t\tarray(9, true, 'http://localhost/m/index'),\n+\t\t);\n+\t}\n+\n+/**\n+ * フルURLを取得する\n+ * getUrl\n+ *\n+ * @param string $url\n+ * @param bool $prefix\n+ * @param bool $useSubDomain\n+ * @return mixed\n+ * @dataProvider getUrlDataProvider\n+ */\n+\tpublic function testGetUrl($url, $full, $useSubDomain, $expect) {\n+\t\t$this->markTestIncomplete('このメソッドは、モデルをラッピングしているメソッドの為スキップします。');\n+//\t\treturn $this->_Content->getUrl($url, $full, $useSubDomain);\n+\t\t$result = $this->BcContents->getUrl($url, $full, $useSubDomain);\n+//\t\tvar_dump($result);\n+\t\t$this->assertEquals($expect, $result);\n+\t}\n+\n+\tpublic function getUrlDataProvider() {\n+\t\treturn array(\n+\t\t\t['/', false, false, '/'],\n+\t\t\t['/', true, false, 'http://localhost/'],\n+\t\t\t['/', true, true, 'http://localhost/'],\n+\t\t\t['/admin/', true, true, 'http://localhost/admin/'],\n+\t\t\t['/admin/', false, true, '/admin/'],\n+\t\t\t['/admin/', false, false, '/admin/'],\n+\t\t);\n+\t}\n+\n+/**\n+ * プレフィックスなしのURLを取得する\n+ * getPureUrl\n+ *\n+ * @param string $url\n+ * @param string $siteId\n+ * @return mixed\n+ * @dataProvider getPureUrlDataProvider\n+ */\n+\tpublic function testGetPureUrl($url, $siteId, $expect) {\n+\t\t$this->markTestIncomplete('このメソッドは、モデルをラッピングしているメソッドの為スキップします。');","path":"lib/Baser/Test/Case/View/Helper/BcContentsHelperTest.php","position":275,"original_position":275,"commit_id":"87367d18196890f4818a29102d00c965771dd769","original_commit_id":"87367d18196890f4818a29102d00c965771dd769","user":{"login":"ryuring","id":90106,"avatar_url":"https://avatars.githubusercontent.com/u/90106?v=3","gravatar_id":"","url":"https://api.github.com/users/ryuring","html_url":"https://github.com/ryuring","followers_url":"https://api.github.com/users/ryuring/followers","following_url":"https://api.github.com/users/ryuring/following{/other_user}","gists_url":"https://api.github.com/users/ryuring/gists{/gist_id}","starred_url":"https://api.github.com/users/ryuring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryuring/subscriptions","organizations_url":"https://api.github.com/users/ryuring/orgs","repos_url":"https://api.github.com/users/ryuring/repos","events_url":"https://api.github.com/users/ryuring/events{/privacy}","received_events_url":"https://api.github.com/users/ryuring/received_events","type":"User","site_admin":false},"body":"こちらも testGetUrlById と同様です。","created_at":"2016-11-30T05:44:42Z","updated_at":"2016-11-30T05:50:01Z","html_url":"https://github.com/baserproject/basercms/pull/538#discussion_r90172077","pull_request_url":"https://api.github.com/repos/baserproject/basercms/pulls/538","_links":{"self":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/comments/90172077"},"html":{"href":"https://github.com/baserproject/basercms/pull/538#discussion_r90172077"},"pull_request":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/538"}}},"pull_request":{"url":"https://api.github.com/repos/baserproject/basercms/pulls/538","id":95824757,"html_url":"https://github.com/baserproject/basercms/pull/538","diff_url":"https://github.com/baserproject/basercms/pull/538.diff","patch_url":"https://github.com/baserproject/basercms/pull/538.patch","issue_url":"https://api.github.com/repos/baserproject/basercms/issues/538","number":538,"state":"open","locked":false,"title":"Ut 2","user":{"login":"katokaisya","id":15135892,"avatar_url":"https://avatars.githubusercontent.com/u/15135892?v=3","gravatar_id":"","url":"https://api.github.com/users/katokaisya","html_url":"https://github.com/katokaisya","followers_url":"https://api.github.com/users/katokaisya/followers","following_url":"https://api.github.com/users/katokaisya/following{/other_user}","gists_url":"https://api.github.com/users/katokaisya/gists{/gist_id}","starred_url":"https://api.github.com/users/katokaisya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katokaisya/subscriptions","organizations_url":"https://api.github.com/users/katokaisya/orgs","repos_url":"https://api.github.com/users/katokaisya/repos","events_url":"https://api.github.com/users/katokaisya/events{/privacy}","received_events_url":"https://api.github.com/users/katokaisya/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-30T04:10:50Z","updated_at":"2016-11-30T05:50:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45ee8fed845dd78478a27740e587b6eba1300545","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/baserproject/basercms/pulls/538/commits","review_comments_url":"https://api.github.com/repos/baserproject/basercms/pulls/538/comments","review_comment_url":"https://api.github.com/repos/baserproject/basercms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/baserproject/basercms/issues/538/comments","statuses_url":"https://api.github.com/repos/baserproject/basercms/statuses/87367d18196890f4818a29102d00c965771dd769","head":{"label":"katokaisya:ut-2","ref":"ut-2","sha":"87367d18196890f4818a29102d00c965771dd769","user":{"login":"katokaisya","id":15135892,"avatar_url":"https://avatars.githubusercontent.com/u/15135892?v=3","gravatar_id":"","url":"https://api.github.com/users/katokaisya","html_url":"https://github.com/katokaisya","followers_url":"https://api.github.com/users/katokaisya/followers","following_url":"https://api.github.com/users/katokaisya/following{/other_user}","gists_url":"https://api.github.com/users/katokaisya/gists{/gist_id}","starred_url":"https://api.github.com/users/katokaisya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katokaisya/subscriptions","organizations_url":"https://api.github.com/users/katokaisya/orgs","repos_url":"https://api.github.com/users/katokaisya/repos","events_url":"https://api.github.com/users/katokaisya/events{/privacy}","received_events_url":"https://api.github.com/users/katokaisya/received_events","type":"User","site_admin":false},"repo":{"id":52329673,"name":"basercms","full_name":"katokaisya/basercms","owner":{"login":"katokaisya","id":15135892,"avatar_url":"https://avatars.githubusercontent.com/u/15135892?v=3","gravatar_id":"","url":"https://api.github.com/users/katokaisya","html_url":"https://github.com/katokaisya","followers_url":"https://api.github.com/users/katokaisya/followers","following_url":"https://api.github.com/users/katokaisya/following{/other_user}","gists_url":"https://api.github.com/users/katokaisya/gists{/gist_id}","starred_url":"https://api.github.com/users/katokaisya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katokaisya/subscriptions","organizations_url":"https://api.github.com/users/katokaisya/orgs","repos_url":"https://api.github.com/users/katokaisya/repos","events_url":"https://api.github.com/users/katokaisya/events{/privacy}","received_events_url":"https://api.github.com/users/katokaisya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/katokaisya/basercms","description":"baserCMS :  Based Website Development Project","fork":true,"url":"https://api.github.com/repos/katokaisya/basercms","forks_url":"https://api.github.com/repos/katokaisya/basercms/forks","keys_url":"https://api.github.com/repos/katokaisya/basercms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katokaisya/basercms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katokaisya/basercms/teams","hooks_url":"https://api.github.com/repos/katokaisya/basercms/hooks","issue_events_url":"https://api.github.com/repos/katokaisya/basercms/issues/events{/number}","events_url":"https://api.github.com/repos/katokaisya/basercms/events","assignees_url":"https://api.github.com/repos/katokaisya/basercms/assignees{/user}","branches_url":"https://api.github.com/repos/katokaisya/basercms/branches{/branch}","tags_url":"https://api.github.com/repos/katokaisya/basercms/tags","blobs_url":"https://api.github.com/repos/katokaisya/basercms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katokaisya/basercms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katokaisya/basercms/git/refs{/sha}","trees_url":"https://api.github.com/repos/katokaisya/basercms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katokaisya/basercms/statuses/{sha}","languages_url":"https://api.github.com/repos/katokaisya/basercms/languages","stargazers_url":"https://api.github.com/repos/katokaisya/basercms/stargazers","contributors_url":"https://api.github.com/repos/katokaisya/basercms/contributors","subscribers_url":"https://api.github.com/repos/katokaisya/basercms/subscribers","subscription_url":"https://api.github.com/repos/katokaisya/basercms/subscription","commits_url":"https://api.github.com/repos/katokaisya/basercms/commits{/sha}","git_commits_url":"https://api.github.com/repos/katokaisya/basercms/git/commits{/sha}","comments_url":"https://api.github.com/repos/katokaisya/basercms/comments{/number}","issue_comment_url":"https://api.github.com/repos/katokaisya/basercms/issues/comments{/number}","contents_url":"https://api.github.com/repos/katokaisya/basercms/contents/{+path}","compare_url":"https://api.github.com/repos/katokaisya/basercms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katokaisya/basercms/merges","archive_url":"https://api.github.com/repos/katokaisya/basercms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katokaisya/basercms/downloads","issues_url":"https://api.github.com/repos/katokaisya/basercms/issues{/number}","pulls_url":"https://api.github.com/repos/katokaisya/basercms/pulls{/number}","milestones_url":"https://api.github.com/repos/katokaisya/basercms/milestones{/number}","notifications_url":"https://api.github.com/repos/katokaisya/basercms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katokaisya/basercms/labels{/name}","releases_url":"https://api.github.com/repos/katokaisya/basercms/releases{/id}","deployments_url":"https://api.github.com/repos/katokaisya/basercms/deployments","created_at":"2016-02-23T04:19:12Z","updated_at":"2016-02-23T04:19:17Z","pushed_at":"2016-11-30T05:45:20Z","git_url":"git://github.com/katokaisya/basercms.git","ssh_url":"git@github.com:katokaisya/basercms.git","clone_url":"https://github.com/katokaisya/basercms.git","svn_url":"https://github.com/katokaisya/basercms","homepage":"http://basercms.net","size":46658,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev-3"}},"base":{"label":"baserproject:dev-4","ref":"dev-4","sha":"6531538ed1ea1353f43d2c90d429c73ac117628d","user":{"login":"baserproject","id":1430314,"avatar_url":"https://avatars.githubusercontent.com/u/1430314?v=3","gravatar_id":"","url":"https://api.github.com/users/baserproject","html_url":"https://github.com/baserproject","followers_url":"https://api.github.com/users/baserproject/followers","following_url":"https://api.github.com/users/baserproject/following{/other_user}","gists_url":"https://api.github.com/users/baserproject/gists{/gist_id}","starred_url":"https://api.github.com/users/baserproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baserproject/subscriptions","organizations_url":"https://api.github.com/users/baserproject/orgs","repos_url":"https://api.github.com/users/baserproject/repos","events_url":"https://api.github.com/users/baserproject/events{/privacy}","received_events_url":"https://api.github.com/users/baserproject/received_events","type":"User","site_admin":false},"repo":{"id":3420388,"name":"basercms","full_name":"baserproject/basercms","owner":{"login":"baserproject","id":1430314,"avatar_url":"https://avatars.githubusercontent.com/u/1430314?v=3","gravatar_id":"","url":"https://api.github.com/users/baserproject","html_url":"https://github.com/baserproject","followers_url":"https://api.github.com/users/baserproject/followers","following_url":"https://api.github.com/users/baserproject/following{/other_user}","gists_url":"https://api.github.com/users/baserproject/gists{/gist_id}","starred_url":"https://api.github.com/users/baserproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baserproject/subscriptions","organizations_url":"https://api.github.com/users/baserproject/orgs","repos_url":"https://api.github.com/users/baserproject/repos","events_url":"https://api.github.com/users/baserproject/events{/privacy}","received_events_url":"https://api.github.com/users/baserproject/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baserproject/basercms","description":"baserCMS :  Based Website Development Project","fork":false,"url":"https://api.github.com/repos/baserproject/basercms","forks_url":"https://api.github.com/repos/baserproject/basercms/forks","keys_url":"https://api.github.com/repos/baserproject/basercms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baserproject/basercms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baserproject/basercms/teams","hooks_url":"https://api.github.com/repos/baserproject/basercms/hooks","issue_events_url":"https://api.github.com/repos/baserproject/basercms/issues/events{/number}","events_url":"https://api.github.com/repos/baserproject/basercms/events","assignees_url":"https://api.github.com/repos/baserproject/basercms/assignees{/user}","branches_url":"https://api.github.com/repos/baserproject/basercms/branches{/branch}","tags_url":"https://api.github.com/repos/baserproject/basercms/tags","blobs_url":"https://api.github.com/repos/baserproject/basercms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baserproject/basercms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baserproject/basercms/git/refs{/sha}","trees_url":"https://api.github.com/repos/baserproject/basercms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baserproject/basercms/statuses/{sha}","languages_url":"https://api.github.com/repos/baserproject/basercms/languages","stargazers_url":"https://api.github.com/repos/baserproject/basercms/stargazers","contributors_url":"https://api.github.com/repos/baserproject/basercms/contributors","subscribers_url":"https://api.github.com/repos/baserproject/basercms/subscribers","subscription_url":"https://api.github.com/repos/baserproject/basercms/subscription","commits_url":"https://api.github.com/repos/baserproject/basercms/commits{/sha}","git_commits_url":"https://api.github.com/repos/baserproject/basercms/git/commits{/sha}","comments_url":"https://api.github.com/repos/baserproject/basercms/comments{/number}","issue_comment_url":"https://api.github.com/repos/baserproject/basercms/issues/comments{/number}","contents_url":"https://api.github.com/repos/baserproject/basercms/contents/{+path}","compare_url":"https://api.github.com/repos/baserproject/basercms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baserproject/basercms/merges","archive_url":"https://api.github.com/repos/baserproject/basercms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baserproject/basercms/downloads","issues_url":"https://api.github.com/repos/baserproject/basercms/issues{/number}","pulls_url":"https://api.github.com/repos/baserproject/basercms/pulls{/number}","milestones_url":"https://api.github.com/repos/baserproject/basercms/milestones{/number}","notifications_url":"https://api.github.com/repos/baserproject/basercms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baserproject/basercms/labels{/name}","releases_url":"https://api.github.com/repos/baserproject/basercms/releases{/id}","deployments_url":"https://api.github.com/repos/baserproject/basercms/deployments","created_at":"2012-02-12T06:13:53Z","updated_at":"2016-10-27T08:39:22Z","pushed_at":"2016-11-30T05:24:56Z","git_url":"git://github.com/baserproject/basercms.git","ssh_url":"git@github.com:baserproject/basercms.git","clone_url":"https://github.com/baserproject/basercms.git","svn_url":"https://github.com/baserproject/basercms","homepage":"http://basercms.net","size":51733,"stargazers_count":91,"watchers_count":91,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":8,"forks":78,"open_issues":8,"watchers":91,"default_branch":"dev-4"}},"_links":{"self":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/538"},"html":{"href":"https://github.com/baserproject/basercms/pull/538"},"issue":{"href":"https://api.github.com/repos/baserproject/basercms/issues/538"},"comments":{"href":"https://api.github.com/repos/baserproject/basercms/issues/538/comments"},"review_comments":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/538/comments"},"review_comment":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/baserproject/basercms/pulls/538/commits"},"statuses":{"href":"https://api.github.com/repos/baserproject/basercms/statuses/87367d18196890f4818a29102d00c965771dd769"}}}}
{"actor":{"display_login":"ryuring"}}