-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccec8dc
commit d99567b
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
tests/unit/Framework/MockObject/Generator/PropertyTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |