This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
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
1d07b7b
commit e26cb90
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
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,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
44
tests/unit/src/DTOMarketplace/Context/Venture/Entity/GetTest.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,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()); | ||
} | ||
} |