<commit_before><?php

namespace PhpAmqpLib\Tests\Functional\Bug;

use PhpAmqpLib\Connection\AMQPStreamConnection;
use PHPUnit\Framework\TestCase;

class Bug458Test extends TestCase
{
    private $channel;

    public function setUp()
    {
        if (!extension_loaded('pcntl')) {
            $this->markTestSkipped('pcntl extension is not available');
        }

        $connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);

        $this->channel = $connection->channel();
        $this->addSignalHandlers();
    }

    protected function tearDown()
    {
        $this->channel->close();
        $this->channel = null;
    }

    /**<commit_msg>fix fatal error when test gets skipped or connection is not available<commit_after><?php

namespace PhpAmqpLib\Tests\Functional\Bug;

use PhpAmqpLib\Connection\AMQPStreamConnection;
use PHPUnit\Framework\TestCase;

class Bug458Test extends TestCase
{
    private $channel;

    protected function setUp()
    {
        if (!extension_loaded('pcntl')) {
            $this->markTestSkipped('pcntl extension is not available');
        }

        $connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST);

        $this->channel = $connection->channel();
        $this->addSignalHandlers();
    }

    protected function tearDown()
    {
        if ($this->channel && $this->channel->is_open()) {
            $this->channel->close();
        }
        $this->channel = null;
    }

    /**
{'fraction_non_alphanumeric': 0.12551159618008187, 'fraction_numerical': 0.004092769440654843, 'mean_word_length': 2.81038961038961, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4721558', 'n_tokens_mistral': 442, 'n_tokens_neox': 424, 'n_words': 92}