Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
get venture
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorsouzadft committed Jul 21, 2016
1 parent 1d07b7b commit e26cb90
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DTOMarketplace/Context/Factory.php
Expand Up @@ -23,6 +23,7 @@ abstract class Factory extends \GFG\DTOContext\Factory\Base
const VENTURE_POSTPAYMENT_FAILDELIVERY = 'venture.postpayment.faildelivery';
const VENTURE_POSTPAYMENT_CANCEL = 'venture.postpayment.cancel';

const VENTURE_ENTITY_GET = 'venture.entity.get';
const VENTURE_ENTITY_CREATE = 'venture.entity.create';
const VENTURE_ENTITY_UPDATE = 'venture.entity.update';

Expand All @@ -49,6 +50,7 @@ abstract class Factory extends \GFG\DTOContext\Factory\Base
self::VENTURE_POSTPAYMENT_FAILDELIVERY => 'Venture\PostPayment\FailDelivery',
self::VENTURE_POSTPAYMENT_CANCEL => 'Venture\PostPayment\Cancel',

self::VENTURE_ENTITY_GET => 'Venture\Entity\Get',
self::VENTURE_ENTITY_CREATE => 'Venture\Entity\Create',
self::VENTURE_ENTITY_UPDATE => 'Venture\Entity\Update'
];
Expand Down
24 changes: 24 additions & 0 deletions src/DTOMarketplace/Context/Venture/Entity/Get.php
@@ -0,0 +1,24 @@
<?php

namespace GFG\DTOMarketplace\Context\Venture\Entity;

use GFG\DTOMarketplace\Context\Base;

class Get extends Base
{
/**
* {@inheritdoc}
*/
public function getHttpMethod()
{
return 'get';
}

/**
* {@inheritdoc}
*/
public function exportContextData()
{
return $this->prepareExport(['id' => $this->getDataWrapper()->getId()]);
}
}
44 changes: 44 additions & 0 deletions tests/unit/src/DTOMarketplace/Context/Venture/Entity/GetTest.php
@@ -0,0 +1,44 @@
<?php

namespace GFG\DTOMarketplace\Context\Venture\Entity;

use GFG\DTOContext\DataWrapper\Mock;

class GetTest extends \PHPUnit_Framework_TestCase
{
private $dw;
private $context;

public function setup()
{
$this->dw = Mock::create(
'GFG\DTOMarketplace\DataWrapper\Venture',
$this
);
$this->context = new Get($this->dw);
}

public function testGetHttpMethod()
{
$this->assertSame('get', $this->context->getHttpMethod());
}

public function testExportContextData()
{
$id = 4;

$this->dw->method('getId')->willReturn($id);

$exportedData = [
'name' => 'gfg.dtomarketplace.context.venture.entity.get',
'info' => [],
'hash' => $this->context->getHash(),
'data_wrapper' => get_class($this->dw),
'data' => [
'id' => $id
]
];

$this->assertSame($exportedData, $this->context->exportContextData());
}
}

0 comments on commit e26cb90

Please sign in to comment.