<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new opTestFunctional(new sfBrowser(), new lime_test(null, new lime_output_color())); include dirname(__FILE__) . '/../../bootstrap/database.php'; $browser->login('*****@*****.**', 'password'); $browser->setCulture('en'); $browser->get('/')->with('user')->isAuthenticated();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $test = new opTestFunctional(new sfBrowser()); $test->setMobile(); include dirname(__FILE__) . '/../../bootstrap/database.php'; $test->login('*****@*****.**', 'password'); $test->setCulture('en'); $test->get('/diary/1')->with('request')->begin()->isParameter('module', 'diary')->isParameter('action', 'show')->isParameter('id', 1)->end()->with('response')->begin()->isStatusCode(200)->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $t = new opTestFunctional(new sfBrowser()); include dirname(__FILE__) . '/../../bootstrap/database.php'; $mailAddress = '*****@*****.**'; $myFriendMailAddress = '*****@*****.**'; $notMyFriendMailAddress = 'sns5@example'; $t->login($mailAddress, 'password'); $t->setCulture('en'); $t->info('should be able to post a new diary entry'); $title = 'テストタイトル'; $body = 'テスト本文'; $publicFlag = PluginDiaryTable::PUBLIC_FLAG_SNS; //全員に公開 $json = $t->post('/diary/post.json', array('apiKey' => 'dummyApiKey', 'title' => $title, 'body' => $body, 'public_flag' => $publicFlag))->getResponse()->getContent(); $data = json_decode($json, true); $t->test()->is($data['status'], 'success', 'should return status code "success"'); $t->test()->ok($data['data']['id'], 'should have id'); $t->test()->ok($data['data']['member'], 'should have member info'); $t->test()->is($data['data']['title'], $title, 'should have the same title posted'); $t->test()->is($data['data']['body'], $body, 'should have the same body posted'); $t->test()->is($data['data']['public_flag'], $publicFlag, 'should have the same publid flag posted'); $t->test()->ok($data['data']['created_at'], 'should have the date posted'); $t->info('should return error when the title is empty'); $json = $t->post('/diary/post.json', array('apiKey' => 'dummyApiKey', 'title' => '', 'body' => $body, 'public_flag' => $publicFlag))->with('response')->begin()->isStatusCode('400')->end(); $json = $t->post('/diary/post.json', array('apiKey' => 'dummyApiKey', 'body' => $body, 'public_flag' => $publicFlag))->with('response')->begin()->isStatusCode('400')->end(); $t->info('should return error when the body is empty'); $json = $t->post('/diary/post.json', array('apiKey' => 'dummyApiKey', 'title' => $title, 'body' => '', 'public_flag' => $publicFlag))->with('response')->begin()->isStatusCode('400')->end(); $json = $t->post('/diary/post.json', array('apiKey' => 'dummyApiKey', 'title' => $title, 'public_flag' => $publicFlag))->with('response')->begin()->isStatusCode('400')->end(); $t->info('should return error when the public flag is empty');