12 public $repositoryMoc = null;
14 public $repositoryOrigin = null;
18 public static function setUpBeforeClass(){
20 Yii::app()->getModule(
'tagcloud');
23 public function setUp(){
26 $this->repositoryMoc = $this->getMock(
'RepositoryApi', array(
'request'));
28 $this->repositoryOrigin = Yii::app()->repositoryApi;
30 $repositoryResponse =
'a:13:{s:6:"status";s:2:"ok";s:7:"10007.3";a:6:{s:9:"contentid";s:7:"10007.3";s:6:"obj_id";s:1:"3";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:1:"7";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:2:{s:13:"edittimestamp";s:10:"1364758042";s:11:"permissions";a:0:{}}}s:10:"10007.3812";a:6:{s:9:"contentid";s:10:"10007.3812";s:6:"obj_id";s:4:"3812";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3343";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:2:{s:13:"edittimestamp";s:10:"1364759267";s:11:"permissions";a:0:{}}}s:10:"10007.3813";a:6:{s:9:"contentid";s:10:"10007.3813";s:6:"obj_id";s:4:"3813";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3342";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:2:{s:13:"edittimestamp";s:10:"1364759288";s:11:"permissions";a:0:{}}}s:10:"10007.3815";a:6:{s:9:"contentid";s:10:"10007.3815";s:6:"obj_id";s:4:"3815";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3341";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:2:{s:13:"edittimestamp";s:10:"1364759347";s:11:"permissions";a:0:{}}}s:10:"10007.3822";a:6:{s:9:"contentid";s:10:"10007.3822";s:6:"obj_id";s:4:"3822";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3343";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1364751584";s:7:"tagging";s:41:"jQuery, Conference, Aloha Editor, Gentics";s:11:"permissions";a:0:{}}}s:10:"10007.3823";a:6:{s:9:"contentid";s:10:"10007.3823";s:6:"obj_id";s:4:"3823";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3342";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1366635676";s:7:"tagging";s:48:"Enterprise 2.0, Blog, Wiki, Crowd, Andrew Mcafee";s:11:"permissions";a:0:{}}}s:10:"10007.3952";a:6:{s:9:"contentid";s:10:"10007.3952";s:6:"obj_id";s:4:"3952";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3343";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1345660473";s:7:"tagging";s:19:"Aloha Editor, HTML5";s:11:"permissions";a:0:{}}}s:10:"10007.3954";a:6:{s:9:"contentid";s:10:"10007.3954";s:6:"obj_id";s:4:"3954";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3343";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1362059693";s:7:"tagging";s:38:"Mobile Websites, iPad, iPhone, Android";s:11:"permissions";a:0:{}}}s:10:"10007.3957";a:6:{s:9:"contentid";s:10:"10007.3957";s:6:"obj_id";s:4:"3957";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3342";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1345696911";s:7:"tagging";s:27:"Google Wave, Enterprise 2.0";s:11:"permissions";a:0:{}}}s:10:"10007.3958";a:6:{s:9:"contentid";s:10:"10007.3958";s:6:"obj_id";s:4:"3958";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3341";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1353009799";s:7:"tagging";s:35:"UX Barcamp, Usability, Aloha Editor";s:11:"permissions";a:0:{}}}s:10:"10007.3961";a:6:{s:9:"contentid";s:10:"10007.3961";s:6:"obj_id";s:4:"3961";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3341";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1363265266";s:7:"tagging";s:36:"Aloha Editor, Dev Con, San Francisco";s:11:"permissions";a:0:{}}}s:10:"10007.3963";a:6:{s:9:"contentid";s:10:"10007.3963";s:6:"obj_id";s:4:"3963";s:8:"obj_type";s:5:"10007";s:9:"mother_id";s:4:"3341";s:11:"mother_type";s:5:"10002";s:10:"attributes";a:3:{s:13:"edittimestamp";s:10:"1362913604";s:7:"tagging";s:27:"OSSBIG, Aloha Editor, Event";s:11:"permissions";a:0:{}}}}';
32 $this->repositoryMoc->expects($this->any())
34 ->will($this->returnValue($repositoryResponse));
36 Yii::app()->setComponent(
'repositoryApi', $this->repositoryMoc);
38 $c =
new CController(
'phpunit');
39 $c->setAction(
new CInlineAction($c,
'urltest'));
40 Yii::app()->setController($c);
56 public function testTagcloud(){
58 Yii::app()->cache->flush();
59 $tagcloudHTML = Yii::app()->controller->widget(
60 'tagcloud.widgets.TagcloudWidget',
62 'folderIds'=>array(
'10002.3341',
'10002.3342',
'10002.3343',
'10002.7'),
63 'usePersonalisation' =>
false,
64 'overviewPage' =>
'/Content.Node/blog/Corporate-Blog.en.html',
65 'tagstyles' => array(
'tagsize_1',
'tagsize_2',
'tagsize_3'),
71 foreach($this->tags as $tag){
73 preg_match(
"/$tag/", $tagcloudHTML, $match);
74 $this->assertNotEmpty($match,
"The tag '$tag' has not been shown");
77 Yii::app()->setComponent(
'repositoryApi', $this->repositoryOrigin);