| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- use App\Service\Rest\Operation\CreateOperation;
- use App\Service\Rest\Operation\UpdateOperation;
- use PHPUnit\Framework\TestCase;
- class UpdateOperationTest extends TestCase
- {
- public function testGetters() {
- $operation = new UpdateOperation(
- 'Update a dinosaur',
- 'dinosaur',
- 1,
- ['weight' => 1800],
- ['weight' => 1600]
- );
- $this->assertEquals('PUT', $operation->getMethod());
- $this->assertEquals('dinosaur', $operation->getEntity());
- $this->assertEquals('dinosaur/1', $operation->getPath());
- $this->assertEquals(['weight' => 1600], $operation->getInitialData());
- $this->assertEquals(['weight' => 1800], $operation->getData());
- $this->assertEquals('PUT dinosaur/1', (string)$operation);
- }
- public function testGetChangeLog() {
- $operation = new UpdateOperation(
- 'Update a dinosaur',
- 'dinosaur',
- 1,
- ['weight' => 1800, 'attrs' => ['vision' => 'movement-based', 'teeth' => '99']],
- ['weight' => 1600, 'attrs' => ['vision' => 'movement-based', 'teeth' => '100']]
- );
- $this->assertEquals(
- [
- '[PUT dinosaur/1]',
- 'weight : `1600` => `1800`',
- 'attrs.teeth : `100` => `99`',
- ],
- $operation->getChangeLog()
- );
- }
- }
|