Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace Sabre\CalDAV\Xml\Request; use Sabre\DAV; use S..

Decoded Output download

<?php

declare(strict_types=1);

namespace Sabre\CalDAV\Xml\Request;

use Sabre\DAV;
use Sabre\DAV\Xml\AbstractXmlTestCase;

class InviteReplyTest extends AbstractXmlTestCase
{
    protected $elementMap = [
        '{http://calendarserver.org/ns/}invite-reply' => 'Sabre\CalDAV\Xml\Request\InviteReply',
    ];

    public function testDeserialize()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
    <cs:invite-accepted />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $result = $this->parse($xml);
        $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_ACCEPTED);

        self::assertEquals(
            $inviteReply,
            $result['value']
        );
    }

    public function testDeserializeDeclined()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
    <cs:invite-declined />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $result = $this->parse($xml);
        $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_DECLINED);

        self::assertEquals(
            $inviteReply,
            $result['value']
        );
    }

    public function testDeserializeNoHostUrl()
    {
        $this->expectException('Sabre\DAV\Exception\BadRequest');
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:invite-declined />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $this->parse($xml);
    }
}

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Sabre\CalDAV\Xml\Request;

use Sabre\DAV;
use Sabre\DAV\Xml\AbstractXmlTestCase;

class InviteReplyTest extends AbstractXmlTestCase
{
    protected $elementMap = [
        '{http://calendarserver.org/ns/}invite-reply' => 'Sabre\\CalDAV\\Xml\\Request\\InviteReply',
    ];

    public function testDeserialize()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
    <cs:invite-accepted />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $result = $this->parse($xml);
        $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_ACCEPTED);

        self::assertEquals(
            $inviteReply,
            $result['value']
        );
    }

    public function testDeserializeDeclined()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
    <cs:invite-declined />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $result = $this->parse($xml);
        $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_DECLINED);

        self::assertEquals(
            $inviteReply,
            $result['value']
        );
    }

    public function testDeserializeNoHostUrl()
    {
        $this->expectException('Sabre\DAV\Exception\BadRequest');
        $xml = <<<XML
<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
    <d:href>/principal/1</d:href>
    <cs:invite-declined />
    <cs:in-reply-to>blabla</cs:in-reply-to>
    <cs:summary>Summary</cs:summary>
</cs:invite-reply>
XML;

        $this->parse($xml);
    }
}

Function Calls

None

Variables

None

Stats

MD5 3a38f28431ade2f62331d791f557a44a
Eval Count 0
Decode Time 78 ms