Changeset 15970
- Timestamp:
- 03/03/09 19:26:30 (4 years ago)
- Files:
-
- plugins/sfEasyCommentsPlugin/trunk/modules/sfEasyComments/templates/_form.php (modified) (1 diff)
- plugins/sfEasyCommentsPlugin/trunk/modules/sfEasyComments/templates/_item.php (modified) (1 diff)
- plugins/sfEasyCommentsPlugin/trunk/tags (deleted)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/config/settings.yml (modified) (2 diffs)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/modules/example (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/modules/example/actions (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/modules/example/actions/actions.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/modules/example/templates (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/modules/example/templates/indexSuccess.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/cache (modified) (1 prop)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php (modified) (1 diff)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/databases.yml (modified) (1 diff)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/doctrine (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/doctrine.db (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/data/sql (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/data/sql/schema.sql (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/BaseFormFilterDoctrine.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/base (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin/base (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsItemFormFilter.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsPlaceholderFormFilter.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin/sfEasyCommentsItemFormFilter.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/filter/doctrine/sfEasyCommentsPlugin/sfEasyCommentsPlaceholderFormFilter.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/BaseFormDoctrine.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/base (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin/base (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsItemForm.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsPlaceholderForm.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin/sfEasyCommentsItemForm.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/form/doctrine/sfEasyCommentsPlugin/sfEasyCommentsPlaceholderForm.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/migration (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/migration/doctrine (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/base (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsItem.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/base/BasesfEasyCommentsPlaceholder.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/sfEasyCommentsItem.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/sfEasyCommentsItemTable.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/sfEasyCommentsPlaceholder.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/lib/model/doctrine/sfEasyCommentsPlugin/sfEasyCommentsPlaceholderTable.class.php (added)
- plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/web/dynamics (added)
- plugins/sfEasyCommentsPlugin/trunk/test/functional/sfEasyCommentsActionsTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfEasyCommentsPlugin/trunk/modules/sfEasyComments/templates/_form.php
r15903 r15970 18 18 19 19 <?php if (count($placeholder['Items'])): ?> 20 21 <hr />22 23 <?php foreach ($placeholder['Items'] as $item):?>24 <?php include_partial('sfEasyComments/item', array('item'=>$item)); ?>25 <?php endforeach; ?>26 20 <ul class="sfEasyCommentsItemList"> 21 <?php foreach ($placeholder['Items'] as $item): ?> 22 <li> 23 <?php include_partial('sfEasyComments/item', array('item'=>$item)); ?> 24 </li> 25 <?php endforeach; ?> 26 </ul> 27 27 <?php endif; ?> plugins/sfEasyCommentsPlugin/trunk/modules/sfEasyComments/templates/_item.php
r15897 r15970 1 <div> 2 <h4> 3 <?php if ($item['author_website']): ?> 4 <a href="<?php echo htmlentities($item['author_website']); ?>" rel="nofollow"><?php echo htmlentities($item['author_name']); ?></a> 5 <?php else: ?> 6 <?php echo htmlentities($item['author_name']); ?> 7 <?php endif; ?> 8 (<?php echo sfEasyCommentsHelper::render_interval(strtotime($item['created_at'])); ?>) 9 </h4> 1 <h4> 2 <?php if ($item['author_website']): ?> 3 <a href="<?php echo htmlentities($item['author_website']); ?>" rel="nofollow"><?php echo htmlentities($item['author_name']); ?></a> 4 <?php else: ?> 5 <?php echo htmlentities($item['author_name']); ?> 6 <?php endif; ?> 7 (<?php echo sfEasyCommentsHelper::render_interval(strtotime($item['created_at'])); ?>) 8 </h4> 10 9 10 <span> 11 11 <?php echo str_replace("\n", '<br />', htmlentities($item['body'])); ?> 12 </ div>12 </span> plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/apps/frontend/config/settings.yml
r15888 r15970 29 29 escaping_method: ESC_SPECIALCHARS # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES, and ESC_SPECIALCHARS. 30 30 31 enabled_modules: 32 - sfDynamics 33 - sfEasyComments 34 31 35 #all: 32 36 # .actions: … … 40 44 # secure_action: secure # The credentials required for an action 41 45 # 42 # module_disabled_module: default # To be called when a user requests 46 # module_disabled_module: default # To be called when a user requests 43 47 # module_disabled_action: disabled # A module disabled in the module.yml 44 48 # plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/cache
- Property svn:ignore set to
*
- Property svn:ignore set to
plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php
r15888 r15970 13 13 public function setup() 14 14 { 15 $this->setPlugins(array('sf EasyCommentsPlugin'));15 $this->setPlugins(array('sfDoctrinePlugin', 'sfDynamicsPlugin', 'sfEasyCommentsPlugin')); 16 16 $this->setPluginPath('sfEasyCommentsPlugin', dirname(__FILE__).'/../../../..'); 17 $this->setPluginPath('sfDynamicsPlugin', realpath(dirname(__FILE__).'/../../../../../sfDynamicsPlugin')); 17 18 } 18 19 } plugins/sfEasyCommentsPlugin/trunk/test/fixtures/project/config/databases.yml
r15888 r15970 1 dev: 2 propel: 1 all: 2 doctrine: 3 class: sfDoctrineDatabase 3 4 param: 4 classname: DebugPDO5 dsn: 'sqlite:///<?php echo dirname(__FILE__); ?>/doctrine.db' 5 6 6 test:7 propel:8 param:9 classname: DebugPDO10 11 all:12 propel:13 class: sfPropelDatabase14 param:15 classname: PropelPDO16 dsn: mysql:dbname=##PROJECT_NAME##;host=localhost17 username: root18 password:19 encoding: utf820 persistent: true21 pooling: trueplugins/sfEasyCommentsPlugin/trunk/test/functional/sfEasyCommentsActionsTest.php
r15896 r15970 4 4 5 5 $browser = new sfTestFunctional(new sfBrowser()); 6 $test = $browser->test(); 7 8 $formData = new testFormData(); 9 10 $browser 11 ->get('/example') 12 ->with('response')->begin() 13 ->isStatusCode(200) 14 ->checkElement('div.sfEasyCommentsFormContainer form.sfEasyCommentsForm', true) 15 ->end() 16 17 ->setField('comment[author_name]', $formData->getAuthorName()) 18 ->setField('comment[author_email]', $formData->getAuthorEmail()) 19 ->setField('comment[author_website]', $formData->getAuthorWebsite()) 20 ->setField('comment[body]', $formData->getBody()) 21 22 ->click('Post!') 23 ; 24 25 $newItem = Doctrine::getTable('sfEasyCommentsItem')->createQuery('i')->orderBy('i.created_at desc')->fetchOne(); 26 27 $test->is($newItem['author_name'], $formData->getAuthorName(), 'newly inserted item contains author name.'); 28 $test->is($newItem['author_email'], $formData->getAuthorEmail(), 'newly inserted item contains author email.'); 29 $test->is($newItem['author_website'], $formData->getAuthorWebsite(), 'newly inserted item contains author website.'); 30 $test->is($newItem['body'], $formData->getBody(), 'newly inserted item contains comment body.'); 31 32 $placeholder = $newItem['Placeholder']; 33 $itemCount = count($placeholder['Items']); 34 35 $browser 36 ->with('response')->begin() 37 ->isStatusCode(200) 38 ->checkElement('div.sfEasyCommentsFormContainer form.sfEasyCommentsForm', false) 39 ->checkElement('ul.sfEasyCommentsItemList li', $itemCount) 40 ->end() 41 ; 42 43 class testFormData 44 { 45 protected 46 $author_name, 47 $author_email, 48 $author_website, 49 $body; 50 51 public function __construct() 52 { 53 $this->author_name = $this->generateRandomString(rand(10, 20)); 54 $this->author_email = $this->generateRandomString(rand(5, 10)).'@example.com'; 55 $this->author_website = 'http://'.$this->generateRandomString(rand(5, 10)).'.example.com/'; 56 57 $this->body = ''; 58 for($words=rand(10,20),$i=0; $i<$words; $i++) 59 { 60 $this->body .= (isset($this->body[0])?' ':'').$this->generateRandomString(rand(2, 15)); 61 } 62 } 63 64 public function getAuthorName() 65 { 66 return $this->author_name; 67 } 68 69 public function getAuthorEmail() 70 { 71 return $this->author_email; 72 } 73 74 public function getAuthorWebsite() 75 { 76 return $this->author_website; 77 } 78 79 public function getBody() 80 { 81 return $this->body; 82 } 83 84 protected function generateRandomString($length) 85 { 86 $str = ''; 87 88 for ($i=0; $i<$length; $i++) 89 { 90 $str .= chr(ord('a')+rand(0,25)); 91 } 92 93 return $str; 94 } 95 }