public function testGridExport()
 {
     $builders = $this->buildData();
     $this->simulateLogin('*****@*****.**');
     $data = array(array('name' => 'value1'), array('name' => 'value2'));
     $json = json_encode($data);
     //echo $json;
     $_POST['grid_export_data'] = $json;
     $controller = new GridExportController(true);
     ob_start();
     $controller->control();
     $results = ob_get_contents();
     ob_end_clean();
     $data = split("\n", $results);
     $this->assertEqual(3, count($data), 'we should have three lines, one blank');
     $value = str_getcsv($data[0]);
     $this->assertEqual($value[0], 'value1');
     $value = str_getcsv($data[1]);
     $this->assertEqual($value[0], 'value2');
     $this->assertEqual($data[2], '');
 }
Beispiel #2
0
/**
 *
 * ThinkUp/webapp/post/grid-export.php
 *
 * Copyright (c) 2009-2012 Mark Wilkie
 *
 * LICENSE:
 *
 * This file is part of ThinkUp (http://thinkupapp.com).
 *
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * @author Mark Wilkie <mark[at]bitterpill[dot]org>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2012 Mark Wilkie
 */
chdir("..");
require_once 'init.php';
$controller = new GridExportController();
echo $controller->go();