Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 14, 2024
1 parent ccec8dc commit d99567b
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/unit/Framework/MockObject/Generator/PropertyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\MockObject\Generator;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

#[CoversClass(Property::class)]
#[Group('test-doubles')]
#[Small]
final class PropertyTest extends TestCase
{
public function testHasName(): void
{
$name = 'property-name';

$property = new Property($name, 'property-type', false, false);

$this->assertSame($name, $property->name());
}

public function testHasType(): void
{
$type = 'property-type';

$property = new Property('property-type', $type, false, false);

$this->assertSame($type, $property->type());
}

public function testMayHaveGetHook(): void
{
$property = new Property('property-name', 'property-type', true, false);

$this->assertTrue($property->hasGetHook());
}

public function testMayNotHaveGetHook(): void
{
$property = new Property('property-name', 'property-type', false, false);

$this->assertFalse($property->hasGetHook());
}

public function testMayHaveSetHook(): void
{
$property = new Property('property-name', 'property-type', false, true);

$this->assertTrue($property->hasSetHook());
}

public function testMayNotHaveSetHook(): void
{
$property = new Property('property-name', 'property-type', false, false);

$this->assertFalse($property->hasSetHook());
}
}

0 comments on commit d99567b

Please sign in to comment.