public function testInvalidUser()
 {
     $request = array("user" => array("username" => 'user_' . mt_rand(), "email" => 'test_' . mt_rand() . '@test.com', "enabled" => 'true', "plainPassword" => '1231231q', "firstName" => "firstName", "lastName" => "lastName", "rolesCollection" => array("1")));
     $this->client->request('POST', $this->client->generate('oro_api_post_user'), $request, array(), array(), ToolsAPI::generateWsseHeader(self::USER_NAME, ToolsAPI::USER_PASSWORD));
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 401);
 }
 public function setUp()
 {
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader(self::USER_NAME, self::USER_PASSWORD));
     if (!self::$hasLoaded) {
         $this->client->appendFixtures(__DIR__ . DIRECTORY_SEPARATOR . 'DataFixtures');
     }
     self::$hasLoaded = true;
 }
 public function setUp()
 {
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader());
     $this->client->soap("http://localhost/api/soap", array('location' => 'http://localhost/api/soap', 'soap_version' => SOAP_1_2));
     if (!self::$hasLoaded) {
         $this->client->appendFixtures(__DIR__ . DIRECTORY_SEPARATOR . 'DataFixtures');
     }
     self::$hasLoaded = true;
 }
 public function testInvalidUser()
 {
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader(self::USER_NAME, ToolsAPI::USER_PASSWORD));
     try {
         $this->client->soap("http://localhost/api/soap", array('location' => 'http://localhost/api/soap', 'soap_version' => SOAP_1_2));
     } catch (\Exception $e) {
         $this->assertEquals('Unauthorized', $e->getMessage());
     }
 }
Exemplo n.º 5
0
 public function setUp()
 {
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader());
 }
 public function setUp()
 {
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader());
     $this->client->soap("http://localhost/api/soap", array('location' => 'http://localhost/api/soap', 'soap_version' => SOAP_1_2));
 }
 public function setUp()
 {
     $this->markTestSkipped("API for new ACL isn't implemented");
     $this->client = static::createClient(array(), ToolsAPI::generateWsseHeader());
     $this->client->soap("http://localhost/api/soap", array('location' => 'http://localhost/api/soap', 'soap_version' => SOAP_1_2));
 }
Exemplo n.º 8
0
 /**
  * Test Empty Body error
  *
  * @depends testNotFound
  * @dataProvider navagationItemsProvider
  */
 public function testEmptyBody($itemType)
 {
     $this->assertNotEmpty(self::$entities[$itemType]);
     $requests = array('POST' => $this->client->generate('oro_api_post_navigationitems', array('type' => $itemType)), 'PUT' => $this->client->generate('oro_api_put_navigationitems_id', array('type' => $itemType, 'itemId' => self::$entities[$itemType]['id'])));
     foreach ($requests as $requestType => $url) {
         $this->client->request($requestType, $url, array(), array(), ToolsAPI::generateWsseHeader());
         /** @var $response Response */
         $response = $this->client->getResponse();
         ToolsAPI::assertJsonResponse($response, 400);
         $responseJson = json_decode($response->getContent(), true);
         $this->assertArrayHasKey('message', $responseJson);
         $this->assertEquals('Wrong JSON inside POST body', $responseJson['message']);
         $this->client->restart();
     }
 }