APIRestTest::testGetMultipleItems PHP Method

testGetMultipleItems() public method

public testGetMultipleItems ( $session_token )
    public function testGetMultipleItems($session_token)
    {
        // Get the User TU_USER and the entity in the same query
        $uid = getItemByTypeName('User', TU_USER, true);
        $eid = getItemByTypeName('Entity', '_test_root_entity', true);
        $res = $this->doHttpRequest('GET', 'getMultipleItems', ['headers' => ['Session-Token' => $session_token], 'query' => ['items' => [['itemtype' => 'User', 'items_id' => $uid], ['itemtype' => 'Entity', 'items_id' => $eid]], 'with_logs' => true, 'expand_dropdowns' => true]]);
        $this->assertEquals(200, $res->getStatusCode());
        $body = $res->getBody();
        $data = json_decode($body, true);
        $this->assertEquals(true, is_array($data));
        $this->assertEquals(2, count($data));
        foreach ($data as $item) {
            $this->assertArrayHasKey('id', $item);
            $this->assertArrayHasKey('name', $item);
            $this->assertArrayNotHasKey('password', $item);
            $this->assertArrayHasKey('entities_id', $item);
            $this->assertArrayHasKey('links', $item);
            $this->assertFalse(is_numeric($item['entities_id']));
            // for expand_dropdowns
            $this->assertArrayHasKey('_logs', $item);
            // with_logs == true
        }
    }