Skip to content

Commit

Permalink
shoppingflux#38 - adding ticket resource and collection basics
Browse files Browse the repository at this point in the history
  • Loading branch information
ddattee committed May 28, 2018
1 parent f971642 commit 7e215b8
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $operations
```

Operations will always be accepted as they are treated asynchronously.
You will be getting a ticket for each operation which will allow to follow up running operations.
You will be getting a ticket for a batch of operations.

### Accept

Expand Down
8 changes: 0 additions & 8 deletions src/Api/Operation/TicketResource.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace ShoppingFeed\Sdk\Api\Operation;
namespace ShoppingFeed\Sdk\Api\Task;

use ShoppingFeed\Sdk\Resource\AbstractCollection;

Expand Down
15 changes: 15 additions & 0 deletions src/Api/Task/TicketResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace ShoppingFeed\Sdk\Api\Task;

use ShoppingFeed\Sdk\Resource\AbstractResource;

class TicketResource extends AbstractResource
{
/**
* @return string
*/
public function getId()
{
return $this->getProperty('id');
}
}
4 changes: 2 additions & 2 deletions src/Order/OrderOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function unacknowledge($reference, $channelName, $status, $storeReference
*
* @param Hal\HalLink $link
*
* @return mixed|Api\Operation\TicketCollection
* @return mixed|Api\Task\TicketCollection
*/
public function execute(Hal\HalLink $link)
{
Expand Down Expand Up @@ -217,7 +217,7 @@ function (Hal\HalResource $resource) use (&$resources) {
$this->getPoolSize()
);

return new Api\Operation\TicketCollection($resources);
return new Api\Task\TicketCollection($resources);
}

/**
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/Api/Task/TicketResourceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace ShoppingFeed\Sdk\Test\Api\Task;

use ShoppingFeed\Sdk\Api\Task\TicketResource;
use ShoppingFeed\Sdk\Test\Api\AbstractResourceTest;

class TicketResourceTest extends AbstractResourceTest
{
public function setUp()
{
$this->props = [
'id' => '123abc',
];
}

public function testGetproperty()
{
$this->initPropertyGetterTester();

$instance = new TicketResource($this->propertyGetter);

$this->assertEquals($this->props['id'], $instance->getId());
}
}
2 changes: 1 addition & 1 deletion tests/unit/Order/OrderOperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function (Sdk\Hal\HalResource $resource) use (&$resources) {


$this->assertInstanceOf(
Sdk\Api\Operation\TicketCollection::class,
Sdk\Api\Task\TicketCollection::class,
$instance->execute($link)
);
}
Expand Down

0 comments on commit 7e215b8

Please sign in to comment.