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 namespace Roundcube\Tests\Framework; use PHPUnit\Framework\Attributes\DataProvider..

Decoded Output download

<?php

namespace Roundcube\Tests\Framework;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
 * Test class to test rcube_enriched class
 */
class EnrichedTest extends TestCase
{
    /**
     * Class constructor
     */
    public function test_class()
    {
        $object = new 
cube_enriched();

        $this->assertInstanceOf(
cube_enriched::class, $object, 'Class constructor');
    }

    /**
     * Test to_html()
     */
    public function test_to_html()
    {
        $enriched = '<bold><italic>the-text</italic></bold>';
        $expected = '<b><i>the-text</i></b>';
        $result = 
cube_enriched::to_html($enriched);

        $this->assertSame($expected, $result);
    }

    /**
     * Data for test_formatting()
     */
    public static function provide_formatting_cases(): iterable
    {
        return [
            ['<bold>', '<b>'],
            ['</bold>', '</b>'],
            ['<italic>', '<i>'],
            ['</italic>', '</i>'],
            ['<fixed>', '<tt>'],
            ['</fixed>', '</tt>'],
            ['<smaller>', '<font size=-1>'],
            ['</smaller>', '</font>'],
            ['<bigger>', '<font size=+1>'],
            ['</bigger>', '</font>'],
            ['<underline>', '<span style="text-decoration: underline">'],
            ['</underline>', '</span>'],
            ['<flushleft>', '<span style="text-align: left">'],
            ['</flushleft>', '</span>'],
            ['<flushright>', '<span style="text-align: right">'],
            ['</flushright>', '</span>'],
            ['<flushboth>', '<span style="text-align: justified">'],
            ['</flushboth>', '</span>'],
            ['<indent>', '<span style="padding-left: 20px">'],
            ['</indent>', '</span>'],
            ['<indentright>', '<span style="padding-right: 20px">'],
            ['</indentright>', '</span>'],
        ];
    }

    /**
     * Test formatting conversion
     *
     * @dataProvider provide_formatting_cases
     */
    #[DataProvider('provide_formatting_cases')]
    public function test_formatting($enriched, $expected)
    {
        $result = 
cube_enriched::to_html($enriched);

        $this->assertSame($expected, $result);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Roundcube\Tests\Framework;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
 * Test class to test rcube_enriched class
 */
class EnrichedTest extends TestCase
{
    /**
     * Class constructor
     */
    public function test_class()
    {
        $object = new \rcube_enriched();

        $this->assertInstanceOf(\rcube_enriched::class, $object, 'Class constructor');
    }

    /**
     * Test to_html()
     */
    public function test_to_html()
    {
        $enriched = '<bold><italic>the-text</italic></bold>';
        $expected = '<b><i>the-text</i></b>';
        $result = \rcube_enriched::to_html($enriched);

        $this->assertSame($expected, $result);
    }

    /**
     * Data for test_formatting()
     */
    public static function provide_formatting_cases(): iterable
    {
        return [
            ['<bold>', '<b>'],
            ['</bold>', '</b>'],
            ['<italic>', '<i>'],
            ['</italic>', '</i>'],
            ['<fixed>', '<tt>'],
            ['</fixed>', '</tt>'],
            ['<smaller>', '<font size=-1>'],
            ['</smaller>', '</font>'],
            ['<bigger>', '<font size=+1>'],
            ['</bigger>', '</font>'],
            ['<underline>', '<span style="text-decoration: underline">'],
            ['</underline>', '</span>'],
            ['<flushleft>', '<span style="text-align: left">'],
            ['</flushleft>', '</span>'],
            ['<flushright>', '<span style="text-align: right">'],
            ['</flushright>', '</span>'],
            ['<flushboth>', '<span style="text-align: justified">'],
            ['</flushboth>', '</span>'],
            ['<indent>', '<span style="padding-left: 20px">'],
            ['</indent>', '</span>'],
            ['<indentright>', '<span style="padding-right: 20px">'],
            ['</indentright>', '</span>'],
        ];
    }

    /**
     * Test formatting conversion
     *
     * @dataProvider provide_formatting_cases
     */
    #[DataProvider('provide_formatting_cases')]
    public function test_formatting($enriched, $expected)
    {
        $result = \rcube_enriched::to_html($enriched);

        $this->assertSame($expected, $result);
    }
}

Function Calls

None

Variables

None

Stats

MD5 ce26ba66cb7d3289b5ca00f2fd6c40c2
Eval Count 0
Decode Time 85 ms