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 RdKafka; use PHPUnit\Framework\TestCase; class ProducerTopicTest extend..

Decoded Output download

<?php

namespace RdKafka;

use PHPUnit\Framework\TestCase;

class ProducerTopicTest extends TestCase
{
    /**
     * @var ProducerTopic
     */
    private $producerTopic;

    public function setUp(): void
    {
        $conf = new Conf();
        $conf->set('metadata.broker.list', 'localhost:9092');
        $producer = new Producer($conf);

        $this->producerTopic = $producer->newTopic('test');
    }

    public function testProducerTopicCantBeInstantiatedDirectly()
    {
        $reflector = new \ReflectionClass(ProducerTopic::class);
        $constructor = $reflector->getConstructor();

        $this->assertTrue($constructor->isPrivate());
    }

    public function testGetName()
    {
        $topicName = $this->producerTopic->getName();

        $this->assertEquals('test', $topicName);
    }

    public function testProduce()
    {
        $this->producerTopic->produce(RD_KAFKA_PARTITION_UA, 0, 'testing kafka messages', 'test_key');

        $this->markTestIncomplete('Add consumer to test if message has been sent');
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace RdKafka;

use PHPUnit\Framework\TestCase;

class ProducerTopicTest extends TestCase
{
    /**
     * @var ProducerTopic
     */
    private $producerTopic;

    public function setUp(): void
    {
        $conf = new Conf();
        $conf->set('metadata.broker.list', 'localhost:9092');
        $producer = new Producer($conf);

        $this->producerTopic = $producer->newTopic('test');
    }

    public function testProducerTopicCantBeInstantiatedDirectly()
    {
        $reflector = new \ReflectionClass(ProducerTopic::class);
        $constructor = $reflector->getConstructor();

        $this->assertTrue($constructor->isPrivate());
    }

    public function testGetName()
    {
        $topicName = $this->producerTopic->getName();

        $this->assertEquals('test', $topicName);
    }

    public function testProduce()
    {
        $this->producerTopic->produce(RD_KAFKA_PARTITION_UA, 0, 'testing kafka messages', 'test_key');

        $this->markTestIncomplete('Add consumer to test if message has been sent');
    }
}

Function Calls

None

Variables

None

Stats

MD5 3bd5d26a12b8073983f89c1edda1061c
Eval Count 0
Decode Time 135 ms