<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; /** * This is an example class of sfTestFunctional * It may require some attention to work with the default values (line 40). */ $browser = new sfBrowser(); $test_browser = new sfTestFunctional($browser); $test_browser->setTester('json.response', 'sfTesterJsonResponse'); $test_browser->get('/episode')->with('request')->begin()->isParameter('module', 'episode')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end()->with('json.response')->begin()->isJson()->end(); /** * Test the creation */ $entity = new Episode(); $entity_array = $entity->exportTo('array'); $identifier = $entity->getTable()->getIdentifier(); /** * Please build a valid $entity_array here */ unset($entity_array[$identifier]); //$entity_array['name'] = "pony"; //$entity_array['created_at'] = date('Y-m-d H:i:s'); //$entity_array['updated_at'] = date('Y-m-d H:i:s'); $test_browser->call('/episode', 'post', array('content' => json_encode($entity_array)))->with('request')->begin()->isParameter('module', 'episode')->isParameter('action', 'create')->end()->with('response')->begin()->isStatusCode(200)->end(); /** * If the new entity has been created */ $location = $browser->getResponse()->getHttpHeader('Location'); if ($location) { // Get ?