ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10397


Ignore:
Timestamp:
Jan 26, 2009, 2:27:31 AM (11 years ago)
Author:
ebihara
Message:

#3372:added the CommunityTopic::isCreatableCommunityTopic() method and added the unit test about it

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityTopic.php

    r10386 r10397  
    1515    return ($this->getMemberId() === $memberId || $this->getCommunity()->isAdmin($memberId));
    1616  }
     17
     18  public function isCreatableComment($memberId)
     19  {
     20    return $this->getCommunity()->isPrivilegeBelong($memberId);
     21  }
    1722}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/test/unit/model/CommunityTopicTest.php

    r10396 r10397  
    44include(dirname(__FILE__).'/../../bootstrap/database.php');
    55
    6 $t = new lime_test(null, new lime_output_color());
     6$t = new lime_test(28, new lime_output_color());
    77
    88//------------------------------------------------------------
     
    4343$t->cmp_ok($community_e->isCreatableCommunityTopic(4), '===', false, 'returns false for a non-community member');
    4444
     45//------------------------------------------------------------
     46// CommunityTopic::isCreatableComment()
     47//------------------------------------------------------------
     48$t->diag('CommunityTopic::isCreatableComment()');
     49
     50// * public_flag:     auth_commu_member
     51// * topic_authority: admin_only
     52$t->diag('public_flag: auth_commu_member, topic_authority: admin_only');
     53$topic_a = CommunityTopicPeer::retrieveByPk(1);
     54$t->cmp_ok($topic_a->isCreatableComment(1), '===', true, 'returns true for the community admin');
     55$t->cmp_ok($topic_a->isCreatableComment(2), '===', true, 'returns true for the community topic author');
     56$t->cmp_ok($topic_a->isCreatableComment(3), '===', true, 'returns true for a community member');
     57$t->cmp_ok($topic_a->isCreatableComment(4), '===', false, 'returns false for a non-community member');
     58
     59// * public_flag:     public
     60// * topic_authority: admin_only
     61$t->diag('public_flag: public, topic_authority: admin_only');
     62$topic_i = CommunityTopicPeer::retrieveByPk(2);
     63$t->cmp_ok($topic_i->isCreatableComment(1), '===', true, 'returns true for the community admin');
     64$t->cmp_ok($topic_i->isCreatableComment(2), '===', true, 'returns true for the community topic author');
     65$t->cmp_ok($topic_i->isCreatableComment(3), '===', true, 'returns true for a community member');
     66$t->cmp_ok($topic_i->isCreatableComment(4), '===', false, 'returns false for a non-community member');
     67
     68// * public_flag:     auth_commu_member
     69// * topic_authority: public
     70$t->diag('public_flag: auth_commu_member, topic_authority: public');
     71$topic_u = CommunityTopicPeer::retrieveByPk(3);
     72$t->cmp_ok($topic_u->isCreatableComment(1), '===', true, 'returns true for the community admin');
     73$t->cmp_ok($topic_u->isCreatableComment(2), '===', true, 'returns true for the community topic author');
     74$t->cmp_ok($topic_u->isCreatableComment(3), '===', true, 'returns true for a community member');
     75$t->cmp_ok($topic_u->isCreatableComment(4), '===', false, 'returns false for a non-community member');
     76
     77// * public_flag:     public
     78// * topic_authority: public
     79$t->diag('public_flag: public, topic_authority: public');
     80$topic_e = CommunityTopicPeer::retrieveByPk(4);
     81$t->cmp_ok($topic_e->isCreatableComment(1), '===', true, 'returns true for the community admin');
     82$t->cmp_ok($topic_e->isCreatableComment(2), '===', true, 'returns true for the community topic author');
     83$t->cmp_ok($topic_e->isCreatableComment(3), '===', true, 'returns true for a community member');
     84$t->cmp_ok($topic_e->isCreatableComment(4), '===', false, 'returns false for a non-community member');
     85
Note: See TracChangeset for help on using the changeset viewer.