APIXmlrpcTest::testCreateItem PHP Method

testCreateItem() public method

public testCreateItem ( $session_token )
    public function testCreateItem($session_token)
    {
        $res = $this->doHttpRequest('createItems', ['session_token' => $session_token, 'itemtype' => 'Computer', 'input' => ['name' => "My computer 1"]]);
        $this->assertEquals(201, $res->getStatusCode());
        $data = xmlrpc_decode($res->getBody());
        $this->assertNotEquals(false, $data);
        $this->assertArrayHasKey('id', $data);
        $id = $data['id'];
        $this->assertEquals(true, is_numeric($id));
        $this->assertEquals(true, $id > 0);
        $this->assertArrayHasKey('message', $data);
        $computer = new Computer();
        $computers_exist = $computer->getFromDB($id);
        $this->assertEquals(true, (bool) $computers_exist);
        return $id;
    }