Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added and fixed functional test.

  • Loading branch information...
commit f1b7bde795580f1c4057c49c4bb970b235ca3bdf 1 parent c9bda5b
@kawahara kawahara authored
View
6 test/bootstrap/database.php
@@ -25,14 +25,13 @@
try
{
- if ($testRevision > (int)Doctrine::getTable('SnsConfig')->get('opOpenSocialPlugin_test_revision'))
+ if ($testRevision > (int)Doctrine::getTable('SnsConfig')->get('opAlbumPlugin_test_revision'))
{
throw new Exception();
}
}
catch (Exception $e)
{
- // for OpenPNE 3.2.x >=
$task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter());
$task->setConfiguration($configuration);
$task->run(array(), array(
@@ -42,5 +41,6 @@
));
$snsConfig = Doctrine::getTable('SnsConfig');
- $snsConfig->set('opOpenSocialPlugin_test_revision', $testRevision);
+ $snsConfig->set('opAlbumPlugin_test_revision', $testRevision);
+ $snsConfig->set('is_check_mobile_ip', 0);
}
View
6 test/bootstrap/functional.php
@@ -22,11 +22,9 @@
chdir(dirname(__FILE__).'/../../../..');
require_once 'config/ProjectConfiguration.class.php';
-$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', false);
+$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
+include dirname(__FILE__).'/database.php';
sfContext::createInstance($configuration);
// remove all cache
sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
-
-$conn = Doctrine_Manager::getInstance()->getCurrentConnection();
-$conn->clear();
View
5 test/fixtures/004_import_admin_user.yml
@@ -0,0 +1,5 @@
+AdminUser:
+ first_admin:
+ id: ~
+ username: "admin"
+ password: "password"
View
108 test/fixtures/005_import_sns_terms.yml
@@ -0,0 +1,108 @@
+SnsTerm:
+ term_friend_pc_frontend:
+ name: "friend"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "フレンド"
+ en:
+ value: "friend"
+
+ term_friend_mobile_frontend:
+ name: "friend"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "フレンド"
+ en:
+ value: "friend"
+
+ term_my_friend_pc_frontend:
+ name: "my_friend"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "マイフレンド"
+ en:
+ value: "my friend"
+
+ term_my_friend_mobile_frontend:
+ name: "my_friend"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "マイフレンド"
+ en:
+ value: "my friend"
+
+ term_community_pc_frontend:
+ name: "community"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "コミュニティ"
+ en:
+ value: "community"
+
+ term_community_mobile_frontend:
+ name: "community"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "コミュニティ"
+ en:
+ value: "community"
+
+ term_nickname_pc_frontend:
+ name: "nickname"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "ニックネーム"
+ en:
+ value: "nickname"
+
+ term_nickname_mobile_frontend:
+ name: "nickname"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "ニックネーム"
+ en:
+ value: "nickname"
+
+ term_activity_pc_frontend:
+ name: "activity"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "アクティビティ"
+ en:
+ value: "activity"
+
+ term_activity_mobile_frontend:
+ name: "activity"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "アクティビティ"
+ en:
+ value: "activity"
+
+ term_post_activity_pc_frontend:
+ name: "post_activity"
+ application: "pc_frontend"
+ Translation:
+ ja_JP:
+ value: "アクティビティ投稿"
+ en:
+ value: "Post Activity"
+
+ term_post_activity_mobile_frontend:
+ name: "post_activity"
+ application: "mobile_frontend"
+ Translation:
+ ja_JP:
+ value: "投稿"
+ en:
+ value: "Post Activity"
View
43 test/functional/mobile_frontend/albumActionsTest.php
@@ -0,0 +1,43 @@
+<?php
+
+$app = 'mobile_frontend';
+include dirname(__FILE__).'/../../bootstrap/functional.php';
+
+$browser = new opBrowser();
+$user = new opTestFunctional($browser, new lime_test(9, new lime_output_color()));
+$user->setMobile();
+
+$user->login('html@example.com', 'password');
+
+// CSRF
+$user
+ ->info('/album/update/1055 - CSRF')
+ ->post('/album/update/1055')
+ ->checkCSRF()
+
+ ->info('/album/delete/1055 - CSRF')
+ ->post('/album/delete/1055')
+ ->checkCSRF()
+
+// XSS
+ ->info('/album - XSS')
+ ->get('/album')
+ ->with('html_escape')->begin()
+ ->isAllEscapedData('Member', 'name')
+ ->countEscapedData(2, 'Album', 'title', array('width' => 36))
+ ->countEscapedData(2, 'Album', 'body', array('width' => 36))
+ ->end()
+
+ ->info('/album/listFriend - XSS')
+ ->get('/album/listFriend')
+ ->with('html_escape')->begin()
+ ->isAllEscapedData('Album', 'title')
+ ->countEscapedData(1, 'Album', 'body', array('width' => 36))
+ ->end()
+
+ ->info('/album/listMember - XSS')
+ ->get('/album/listMember')
+ ->with('html_escape')->begin()
+ ->isAllEscapedData('Album', 'title')
+ ->countEscapedData(1, 'Album', 'body', array('width' => 36))
+ ->end();
View
28 test/functional/mobile_frontend/albumImageActionsTest.php
@@ -0,0 +1,28 @@
+<?php
+
+$app = 'mobile_frontend';
+include dirname(__FILE__).'/../../bootstrap/functional.php';
+
+$browser = new sfBrowser();
+$user = new opTestFunctional($browser, new lime_test(3, new lime_output_color()));
+$user->setMobile();
+
+$user->login('html@example.com', 'password');
+
+// CSRF
+$user
+ ->info('/album/photo/update/1055 - CSRF')
+ ->post('/album/photo/update/1055')
+ ->checkCSRF()
+
+ ->info('/album/photo/delete/1055 - CSRF')
+ ->post('/album/photo/delete/1055')
+ ->checkCSRF()
+
+// XSS
+ ->info('/album/photo/1055 - XSS')
+ ->get('/album/photo/1055')
+ ->with('html_escape')->begin()
+ ->isAllEscapedData('AlbumImage', 'description')
+ ->end()
+;
View
8 test/functional/pc_backend/albumActionsTest.php
@@ -1,11 +1,11 @@
<?php
-$_app = 'pc_backend';
+$app = 'pc_backend';
include(dirname(__FILE__).'/../../bootstrap/functional.php');
-include(dirname(__FILE__).'/../../bootstrap/database.php');
-$browser = new opTestFunctional(new opBrowser(), new lime_test(null, new lime_output_color()));
-$browser
+$browser = new opBrowser();
+$user = new opTestFunctional($browser, new lime_test(8, new lime_output_color()));
+$user
->info('Login')
->get('/default/login')
->click('ログイン', array('admin_user' => array(
View
5 test/functional/pc_backend/albumImageActionsTest.php
@@ -1,10 +1,9 @@
<?php
-$_app = 'pc_backend';
+$app = 'pc_backend';
include(dirname(__FILE__).'/../../bootstrap/functional.php');
-include(dirname(__FILE__).'/../../bootstrap/database.php');
-$browser = new opTestFunctional(new opBrowser(), new lime_test(null, new lime_output_color()));
+$browser = new opTestFunctional(new opBrowser(), new lime_test(8, new lime_output_color()));
$browser
->info('Login')
->get('/default/login')
View
11 test/functional/pc_frontend/albumActionsTest.php
@@ -1,13 +1,13 @@
<?php
include dirname(__FILE__).'/../../bootstrap/functional.php';
-include dirname(__FILE__).'/../../bootstrap/database.php';
-$browser = new opTestFunctional(new sfBrowser());
-$browser->login('html@example.com', 'password');
+$browser = new sfBrowser();
+$user = new opTestFunctional($browser, new lime_test(16, new lime_output_color()));
+$user->login('html@example.com', 'password');
// CSRF
-$browser
+$user
->info('/album/create - CSRF')
->post('/album/create')
->checkCSRF()
@@ -64,5 +64,4 @@
->with('html_escape')->begin()
->isAllEscapedData('Member', 'name')
->isAllEscapedData('Album', 'title')
- ->end()
-;
+ ->end();
View
12 test/functional/pc_frontend/albumImageActionsTest.php
@@ -1,13 +1,13 @@
<?php
include dirname(__FILE__).'/../../bootstrap/functional.php';
-include dirname(__FILE__).'/../../bootstrap/database.php';
-$browser = new opTestFunctional(new sfBrowser());
-$browser->login('html@example.com', 'password');
+$browser = new sfBrowser();
+$user = new opTestFunctional($browser, new lime_test(5, new lime_output_color()));
+$user->login('html@example.com', 'password');
// CSRF
-$browser
+$user
->info('/album/1055/photo/insert - CSRF')
->post('/album/1055/photo/insert')
->checkCSRF()
@@ -21,8 +21,8 @@
->checkCSRF()
// XSS
- ->info('/album/1055/photo/insert - XSS')
- ->get('/album/1055/photo/insert')
+ ->info('/album/1055/photo/add - XSS')
+ ->get('/album/1055/photo/add')
->with('html_escape')->begin()
->isAllEscapedData('Album', 'title')
->end()
Please sign in to comment.
Something went wrong with that request. Please try again.