| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Tests\Service\Rest\Operation;
- use App\Service\Rest\Operation\DeleteOperation;
- use PHPUnit\Framework\TestCase;
- class TestableDeleteOperation extends DeleteOperation {
- public function getExpectedResult(): ?array { return parent::getExpectedResult(); }
- }
- class DeleteOperationTest extends TestCase
- {
- /**
- * @see DeleteOperation::__construct()
- * @see DeleteOperation::getMethod()
- * @see DeleteOperation::getEntityName()
- * @see DeleteOperation::getPath()
- * @see DeleteOperation::__toString()
- */
- public function testGetters(): void
- {
- $operation = new DeleteOperation(
- 'Delete a dinosaur',
- 'dinosaur',
- 1
- );
- $this->assertEquals('DELETE', $operation->getMethod());
- $this->assertEquals('dinosaur', $operation->getEntityName());
- $this->assertEquals('dinosaur/1', $operation->getPath());
- $this->assertEquals('DELETE dinosaur/1', (string)$operation);
- }
- /**
- * @see DeleteOperation::getExpectedResult()
- */
- public function testGetExpectedResult(): void {
- $operation = new TestableDeleteOperation(
- 'Delete a dinosaur',
- 'dinosaur',
- 1
- );
- $this->assertEquals(null, $operation->getExpectedResult());
- }
- /**
- * @see DeleteOperation::getChangeLog()
- */
- public function testGetChangeLog(): void
- {
- $operation = new DeleteOperation(
- 'Delete a dinosaur',
- 'dinosaur',
- 1
- );
- $this->assertEquals(
- ['[DELETE dinosaur/1]'],
- $operation->getChangeLog()
- );
- }
- }
|