/** * Test the user list */ public function testGetUsersAction() { $this->setRequestUrl('Core/user/jsonGetUsers'); $this->request->setParam('nodeId', 1); $response = FrontInit::phprJsonToArray($this->getResponse()); $expected = array('data' => array(array('id' => 2, 'display' => ', Luise Marie'), array('id' => 1, 'display' => 'Mustermann, Max'))); $this->assertEquals($expected, $response); }
/** * Test the multiple save with error */ public function testJsonSaveMultipleError() { $this->setRequestUrl('Project/index/jsonSaveMultiple'); $items = array(2 => array('projectId' => '2')); $this->request->setParam('data', $items); $this->request->setParam('nodeId', 1); $response = FrontInit::phprJsonToArray($this->getResponse()); $expected = array('type' => 'error', 'message' => 'ID 2. Parent: The project can not be saved under itself', 'id' => 2); $this->assertEquals($expected, $response); }
/** * Test noraml call */ public function testJsonGetStatistic() { $this->setRequestUrl('Statistic/index/jsonGetStatistic/'); $this->request->setParam('startDate', '2009-05-01'); $this->request->setParam('endDate', '2009-05-31'); $this->request->setParam('nodeId', 1); $response = FrontInit::phprJsonToArray($this->getResponse()); $expected = array('data' => array('users' => array(1 => 'Test'), 'projects' => array(1 => 'PHProjekt', 2 => 'Test Project', 5 => 'Sub Project', 6 => 'Sub Sub Project 1', 7 => 'Sub Sub Project 2'), 'rows' => array(1 => array(1 => 360)))); $this->assertEquals($expected, $response); }
/** * Test of json Favorites Save */ public function testJsonFavoritesSave() { // INSERT $this->setRequestUrl('Timecard/index/jsonFavoritesSave/'); $favorites = array(0 => 1, 1 => 2); $this->request->setParam('favorites', $favorites); $response = $this->getResponse(); $this->assertContains(Timecard_IndexController::EDIT_TRUE_TEXT, $response); $this->_reset(); $this->setRequestUrl('Timecard/index/jsonGetFavoritesProjects/'); $response = FrontInit::phprJsonToArray($this->getResponse()); $expected = array(array('id' => 1, 'display' => 'PHProjekt', 'name' => 'PHProjekt'), array('id' => 2, 'display' => 'Test Project', 'name' => 'Test Project')); $this->assertEquals($expected, $response); }
/** * Test of jsonGetUsersRightsAction */ public function testJsonGetUsersRightsAction() { $this->setRequestUrl('Project/index/jsonGetUsersRights/'); $this->request->setParam('id', 2); $response = FrontInit::phprJsonToArray($this->getResponse()); $expected = array(1 => array('none' => false, 'read' => true, 'write' => true, 'access' => true, 'create' => true, 'copy' => true, 'delete' => true, 'download' => true, 'admin' => true, 'moduleId' => 1, 'itemId' => 2, 'userId' => 1)); $this->assertEquals($expected, $response); }
/** * Test of json list Filemanager -in fact, default json detail */ public function testJsonDetail() { // Existing item $this->setRequestUrl('Filemanager/index/jsonDetail/'); $this->request->setParam('id', 1); $this->request->setParam('nodeId', 1); $response = FrontInit::phprJsonToArray($this->getResponse()); $expectedData = array(array('id' => 1, 'title' => 'TestFoobar', 'comments' => 'Foobar', 'projectId' => 1, 'files' => '966f9bfa01ec4a2a3fa6282bb8fa8d56|articles.txt', 'rights' => array(1 => array('none' => true, 'read' => false, 'write' => false, 'access' => false, 'create' => false, 'copy' => false, 'delete' => false, 'download' => false, 'admin' => false)))); $expectedNumRows = 1; $this->assertEquals($expectedData, $response['data']); $this->assertEquals($expectedNumRows, $response['numRows']); }
/** * Test of jsonGetTagsByModuleAction */ public function testGetTagsByModuleActionNoId() { $this->setRequestUrl('Default/Tag/jsonGetTagsByModule/'); $this->request->setParam('moduleName', 'Project'); $response = FrontInit::phprJsonToArray($this->getResponse()); $this->assertEquals(array('metadata' => array(array('key' => 'string', 'label' => 'Tags'), array('key' => 'count', 'label' => 'Count')), 'data' => array(), 'numRows' => 0), $response); }
/** * setUp method for PHPUnit */ public function setUp() { parent::setUp(); $this->_listingExpectedString = '{"key":"title","label":"Title","originalLabel":"Title","type":"text",' . '"hint":"","listPosition":1,"formPosition":1'; $this->_model = new Gantt_Models_Gantt(); }
/** * Test of json detail */ public function testJsonDetail() { // Check it $this->setRequestUrl('Contact/index/jsonDetail/'); $this->request->setParam('id', 1); $this->request->setParam('nodeId', 1); $response = FrontInit::phprJsonToArray($this->getResponse()); $expectedData = array(array('id' => 1, 'name' => 'Mariano', 'email' => '*****@*****.**', 'company' => 'Mayflower', 'firstphone' => '004912341234', 'secondphone' => '004923452345', 'mobilephone' => '004934563456', 'street' => 'Edison 1234', 'city' => 'Buenos Aires', 'zipcode' => '1234AAA', 'country' => 'Argentina', 'comment' => 'This is a comment', 'private' => 0, 'rights' => array(1 => array('none' => false, 'read' => false, 'write' => false, 'access' => false, 'create' => false, 'copy' => false, 'delete' => false, 'download' => false, 'admin' => false)))); $expectedNumRows = 1; $this->assertEquals($expectedData, $response['data']); $this->assertEquals($expectedNumRows, $response['numRows']); }