Files
Phraseanet/tests/Alchemy/Phrasea/Controller/Root/AccountTest.php
2012-07-18 17:14:30 +02:00

78 lines
2.1 KiB
PHP

<?php
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
public function setUp()
{
parent::setUp();
$this->client = $this->createClient();
}
public function createApplication()
{
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Root.php';
$app['debug'] = true;
unset($app['exception_handler']);
return $app;
}
public function testGetAccount()
{
$this->client->request('GET', '/account/');
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testUpdateAccount()
{
$core = \bootstrap::getCore();
$appbox = \appbox::get_instance($core);
$bases = array();
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$bases[] = $collection->get_base_id();
}
}
if(0 === count($bases)) {
$this->markTestSkipped('No collections');
}
$this->client->request('POST', '/account/', array(
'demand' => $bases,
'form_gender' => 'M',
'form_firstname' => 'gros',
'form_lastname' => 'minet',
'form_address' => 'rue du lac',
'form_zip' => '75005',
'form_phone' => '+33645787878',
'form_fax' => '+33145787845',
'form_function' => 'astronaute',
'form_company' => 'NASA',
'form_activity' => 'Space',
'form_geonameid' => '',
'form_addrFTP' => '',
'form_loginFTP' => '',
'form_pwdFTP' => '',
'form_destFTP' => '',
'form_prefixFTPfolder' => '',
'form_defaultdataFTP' => array('document', 'preview', 'caption'),
'mail_notifications' => '1'
));
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals('minet', $core->getAUthenticatedUser()->get_lastname());
}
}