<commit_before><?php

declare(strict_types=1);

namespace Rebing\GraphQL\Tests\Unit;

use Closure;
use Rebing\GraphQL\Tests\TestCase;
use GraphQL\Type\Definition\InterfaceType;
use Rebing\GraphQL\Tests\Support\Objects\ExampleInterfaceType;

class InterfaceTypeTest extends TestCase
{
    /**
     * Test get attributes.
     */
    public function testGetAttributes(): void
    {
        $type = new ExampleInterfaceType();
        $attributes = $type->getAttributes();

        $this->assertArrayHasKey('resolveType', $attributes);
        $this->assertInstanceOf(Closure::class, $attributes['resolveType']);
    }

    /**
     * Test get attributes resolve type.
     */
    public function testGetAttributesResolveType(): void
    {
        $type = $this->getMockBuilder(ExampleInterfaceType::class)
                    ->setMethods(['resolveType'])
                    ->getMock();

        $type->expects($this->once())
            ->method('resolveType');

        $attributes = $type->getAttributes();
        $attributes['resolveType'](null);
    }

    /**
     * Test to type.
     */
    public function testToType(): void
    {
        $type = new ExampleInterfaceType();
        $interfaceType = $type->toType();

        $this->assertInstanceOf(InterfaceType::class, $interfaceType);

        $this->assertEquals($interfaceType->name, $type->name);

        $fields = $interfaceType->getFields();
        $this->assertArrayHasKey('test', $fields);
    }
}<commit_msg>tests: add typehint for InterfaceType<commit_after><?php

declare(strict_types=1);

namespace Rebing\GraphQL\Tests\Unit;

use Closure;
use Rebing\GraphQL\Tests\TestCase;
use GraphQL\Type\Definition\InterfaceType;
use Rebing\GraphQL\Tests\Support\Objects\ExampleInterfaceType;

class InterfaceTypeTest extends TestCase
{
    /**
     * Test get attributes.
     */
    public function testGetAttributes(): void
    {
        $type = new ExampleInterfaceType();
        $attributes = $type->getAttributes();

        $this->assertArrayHasKey('resolveType', $attributes);
        $this->assertInstanceOf(Closure::class, $attributes['resolveType']);
    }

    /**
     * Test get attributes resolve type.
     */
    public function testGetAttributesResolveType(): void
    {
        $type = $this->getMockBuilder(ExampleInterfaceType::class)
                    ->setMethods(['resolveType'])
                    ->getMock();

        $type->expects($this->once())
            ->method('resolveType');

        $attributes = $type->getAttributes();
        $attributes['resolveType'](null);
    }

    /**
     * Test to type.
     */
    public function testToType(): void
    {
        $type = new ExampleInterfaceType();
        /** @var InterfaceType $interfaceType */
        $interfaceType = $type->toType();

        $this->assertInstanceOf(InterfaceType::class, $interfaceType);

        $this->assertEquals($interfaceType->name, $type->name);

        $fields = $interfaceType->getFields();
        $this->assertArrayHasKey('test', $fields);
    }
}
{'fraction_non_alphanumeric': 0.14224563714191638, 'fraction_numerical': 0.0006585446163977609, 'mean_word_length': 2.8261964735516374, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '4101531', 'n_tokens_mistral': 843, 'n_tokens_neox': 815, 'n_words': 147}