<commit_before><?php declare(strict_types=1);

/**
 * @license Apache 2.0
 */

namespace SwaggerTests;

use Swagger\Processors\AugmentProperties;
use Swagger\Processors\AugmentSchemas;
use Swagger\Processors\MergeIntoComponents;
use Swagger\Processors\MergeIntoOpenApi;
use Swagger\StaticAnalyser;

class AugmentPropertiesTest extends SwaggerTestCase
{
    public function testAugmentProperties()
    {
        $analyser = new StaticAnalyser();
        $analysis = $analyser->fromFile(__DIR__.'/Fixtures/Customer.php');
        $analysis->process(new MergeIntoOpenApi());
        $analysis->process(new MergeIntoComponents());
        $analysis->process(new AugmentSchemas());
        $customer = $analysis->openapi->components->schemas[0];
        $firstname = $customer->properties[0];
        $lastname = $customer->properties[1];
        $tags = $customer->properties[2];
        $submittedBy = $customer->properties[3];
        $friends = $customer->properties[4];

        // Verify no values where defined in the annotation.
        $this->assertNull($firstname->property);
        $this->assertNull($firstname->description);
        $this->assertNull($firstname->type);

        $this->assertNull($lastname->property);
        $this->assertNull($lastname->description);
        $this->assertNull($lastname->type);

        $this->assertNull($tags->property);
        $this->assertNull($tags->type);
        $this->assertNull($tags->items);

        $this->assertNull($submittedBy->property);
        $this->assertNull($submittedBy->ref);

        $this->assertNull($friends->property);
        $this->assertNull($friends->type);

        $analysis->process(new AugmentProperties());

        $this->assertSame('firstname', $firstname->property, '@OAS\Property()->property based on propertyname');
        $this->assertSame('The firstname of the customer.', $firstname->description, '@OAS\Property()->description based on @var description');
        $this->assertSame('string', $firstname->type, '@OAS\Property()->type based on @var declaration');

        $this->assertSame('lastname', $lastname->property);<commit_msg>add example property test<commit_after><?php declare(strict_types=1);

/**
 * @license Apache 2.0
 */

namespace SwaggerTests;

use Swagger\Processors\AugmentProperties;
use Swagger\Processors\AugmentSchemas;
use Swagger\Processors\MergeIntoComponents;
use Swagger\Processors\MergeIntoOpenApi;
use Swagger\StaticAnalyser;

class AugmentPropertiesTest extends SwaggerTestCase
{
    public function testAugmentProperties()
    {
        $analyser = new StaticAnalyser();
        $analysis = $analyser->fromFile(__DIR__.'/Fixtures/Customer.php');
        $analysis->process(new MergeIntoOpenApi());
        $analysis->process(new MergeIntoComponents());
        $analysis->process(new AugmentSchemas());
        $customer = $analysis->openapi->components->schemas[0];
        $firstname = $customer->properties[0];
        $lastname = $customer->properties[1];
        $tags = $customer->properties[2];
        $submittedBy = $customer->properties[3];
        $friends = $customer->properties[4];

        // Verify no values where defined in the annotation.
        $this->assertNull($firstname->property);
        $this->assertNull($firstname->description);
        $this->assertNull($firstname->type);

        $this->assertNull($lastname->property);
        $this->assertNull($lastname->description);
        $this->assertNull($lastname->type);

        $this->assertNull($tags->property);
        $this->assertNull($tags->type);
        $this->assertNull($tags->items);

        $this->assertNull($submittedBy->property);
        $this->assertNull($submittedBy->ref);

        $this->assertNull($friends->property);
        $this->assertNull($friends->type);

        $analysis->process(new AugmentProperties());

        $this->assertSame('firstname', $firstname->property, '@OAS\Property()->property based on propertyname');
        $this->assertEquals('test_user', $firstname->example);
        $this->assertSame('The firstname of the customer.', $firstname->description, '@OAS\Property()->description based on @var description');
        $this->assertSame('string', $firstname->type, '@OAS\Property()->type based on @var declaration');

        $this->assertSame('lastname', $lastname->property);
{'fraction_non_alphanumeric': 0.15846615846615847, 'fraction_numerical': 0.004158004158004158, 'mean_word_length': 3.7898230088495577, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 105, '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': '3374894', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1184, 'n_words': 196}