Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
https://redmine.openpne.jp/issues/3852 が修正されていないと動作しないテストコード
<?php
// このファイルは test/functional/pc_frontend/ 以下に設置する
require_once __DIR__.'/../../bootstrap/functional.php';
$tester = new opTestFunctional(new opBrowser());
$member6 = Doctrine_Core::getTable('Member')->find(6);
$member6->setConfig('pc_address', 'sns6@example.com');
$member6->setConfig('password', md5('password'));
$testcases = array();
$testcases[] = function($tester)
{
$tester->info('member/profile: age_public_flag = 1 [View profile by friend]');
$memberConfig = Doctrine_Core::getTable('MemberConfig')->create(array(
'member_id' => 1,
'name' => 'age_public_flag',
'value' => 1,
));
$memberConfig->save();
$memberRelationship = Doctrine_Core::getTable('MemberRelationship')->retrieveByFromAndTo(1, 6);
$memberRelationship->setFriend();
$tester
->login('sns6@example.com', 'password')
->get('/member/1')
->with('response')->begin()
->checkElement('#profile th:contains("年齢")', 1)
->end()
;
};
$testcases[] = function($tester)
{
$tester->info('member/profile: age_public_flag = 1 [View profile by others]');
$memberConfig = Doctrine_Core::getTable('MemberConfig')->create(array(
'member_id' => 1,
'name' => 'age_public_flag',
'value' => 1,
));
$memberConfig->save();
$tester
->login('sns6@example.com', 'password')
->get('/member/1')
->with('response')->begin()
->checkElement('#profile th:contains("年齢")', 1)
->end()
;
};
$testcases[] = function($tester)
{
$tester->info('member/profile: age_public_flag = 3 [View profile by friend]');
$memberConfig = Doctrine_Core::getTable('MemberConfig')->create(array(
'member_id' => 1,
'name' => 'age_public_flag',
'value' => 3,
));
$memberConfig->save();
$memberRelationship = Doctrine_Core::getTable('MemberRelationship')->retrieveByFromAndTo(1, 6);
$memberRelationship->setFriend();
$tester
->login('sns6@example.com', 'password')
->get('/member/1')
->with('response')->begin()
->checkElement('#profile th:contains("年齢")', 0)
->end()
;
};
$testcases[] = function($tester)
{
$tester->info('member/profile: age_public_flag = 3 [View profile by others]');
$memberConfig = Doctrine_Core::getTable('MemberConfig')->create(array(
'member_id' => 1,
'name' => 'age_public_flag',
'value' => 3,
));
$memberConfig->save();
$tester
->login('sns6@example.com', 'password')
->get('/member/1')
->with('response')->begin()
->checkElement('#profile th:contains("年齢")', 0)
->end()
;
};
$conn = Doctrine_Manager::connection();
foreach ($testcases as $testcase)
{
$conn->beginTransaction();
$testcase($tester);
$conn->rollback();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.