<commit_before><?php

declare(strict_types=1);

namespace DontTest\Exception;

use Dont\Exception\ExceptionInterface;
use Dont\Exception\NonDeSerializableObject;
use Dont\Exception\TypeError;
use LogicException;
use stdClass;

/**
 * @covers \Dont\Exception\NonDeSerializableObject
 */
final class NonDeSerializableObjectTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider objectProvider
     *
     * @param object $object
     *
     * @return void
     */
    public function testFromAttemptedDeSerialization($object)
    {
        $exception = NonDeSerializableObject::fromAttemptedDeSerialization($object);

        self::assertInstanceOf(NonDeSerializableObject::class, $exception);
        self::assertInstanceOf(LogicException::class, $exception);
        self::assertInstanceOf(ExceptionInterface::class, $exception);

        $expected = 'The given object ' . get_class($object)
            . '#' . spl_object_hash($object) . ' is not designed to be de-serialized, '
            . "yet de-serialization was attempted.\n\n"
            . 'This error is raised because the author of ' . get_class($object)
            . " didn't design it to be de-serializable, nor can\n"
            . "guarantee that it will function correctly after de-serialization, nor can guarantee that all\n"
            . "its internal components are de-serializable.\n\n"
            . 'Please do not use unserialize() to produce ' . get_class($object) . ' instances.';

        self::assertSame($expected, $exception->getMessage());
    }

    /**
     * @return object[][]
     */
    public function objectProvider() : array
    {
        return [
            [new stdClass()],
            [$this],
        ];
    }

    /**
     * @dataProvider nonObjectProvider
     *
     * @param mixed $nonObject
     *
     * @return void
     */
    public function testWillThrowOnNonObject($nonObject)
    {
        $this->expectException(TypeError::class);

        NonDeSerializableObject::fromAttemptedSerialization($nonObject);
    }

    /**
     * @return mixed[][]
     */
    public function nonObjectProvider() : array
    {
        return [
            [null],
            [true],
            [123],
            [12.3],
            ['foo'],
            [[]],
            [STDERR],
        ];
    }
}<commit_msg>Corrected method call (was calling non-existing method) - c&p mistake<commit_after><?php

declare(strict_types=1);

namespace DontTest\Exception;

use Dont\Exception\ExceptionInterface;
use Dont\Exception\NonDeSerializableObject;
use Dont\Exception\TypeError;
use LogicException;
use stdClass;

/**
 * @covers \Dont\Exception\NonDeSerializableObject
 */
final class NonDeSerializableObjectTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider objectProvider
     *
     * @param object $object
     *
     * @return void
     */
    public function testFromAttemptedDeSerialization($object)
    {
        $exception = NonDeSerializableObject::fromAttemptedDeSerialization($object);

        self::assertInstanceOf(NonDeSerializableObject::class, $exception);
        self::assertInstanceOf(LogicException::class, $exception);
        self::assertInstanceOf(ExceptionInterface::class, $exception);

        $expected = 'The given object ' . get_class($object)
            . '#' . spl_object_hash($object) . ' is not designed to be de-serialized, '
            . "yet de-serialization was attempted.\n\n"
            . 'This error is raised because the author of ' . get_class($object)
            . " didn't design it to be de-serializable, nor can\n"
            . "guarantee that it will function correctly after de-serialization, nor can guarantee that all\n"
            . "its internal components are de-serializable.\n\n"
            . 'Please do not use unserialize() to produce ' . get_class($object) . ' instances.';

        self::assertSame($expected, $exception->getMessage());
    }

    /**
     * @return object[][]
     */
    public function objectProvider() : array
    {
        return [
            [new stdClass()],
            [$this],
        ];
    }

    /**
     * @dataProvider nonObjectProvider
     *
     * @param mixed $nonObject
     *
     * @return void
     */
    public function testWillThrowOnNonObject($nonObject)
    {
        $this->expectException(TypeError::class);

        NonDeSerializableObject::fromAttemptedDeSerialization($nonObject);
    }

    /**
     * @return mixed[][]
     */
    public function nonObjectProvider() : array
    {
        return [
            [null],
            [true],
            [123],
            [12.3],
            ['foo'],
            [[]],
            [STDERR],
        ];
    }
}
{'fraction_non_alphanumeric': 0.11851063829787234, 'fraction_numerical': 0.0029787234042553193, 'mean_word_length': 2.3578571428571427, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2400437', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1286, 'n_words': 280}