Skip to content

Commit

Permalink
Creates price model class
Browse files Browse the repository at this point in the history
Issue: documentacao-e-tarefas/desenvolvimento_e_infra#892

Signed-off-by: Thiago <thiago@lepidus.com.br>
  • Loading branch information
thiagolepidus committed Oct 1, 2024
1 parent 454df9d commit 0609cf7
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
46 changes: 46 additions & 0 deletions src/GraphQL/Model/Price.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace ThothClient\GraphQL\Model;

class Price extends AbstractModel
{
public function getPriceId(): string
{
return $this->getData('priceId');
}

public function setPriceId(string $priceId): void
{
$this->setData('priceId', $priceId);
}

public function getPublicationId(): string
{
return $this->getData('publicationId');
}

public function setPublicationId(string $publicationId): void
{
$this->setData('publicationId', $publicationId);
}

public function getCurrentCode(): string
{
return $this->getData('currentCode');
}

public function setCurrentCode(string $currentCode): void
{
$this->setData('currentCode', $currentCode);
}

public function getUnitPrice(): float
{
return $this->getData('unitPrice');
}

public function setUnitPrice(float $unitPrice): void
{
$this->setData('unitPrice', $unitPrice);
}
}
2 changes: 1 addition & 1 deletion tests/GraphQL/Model/IssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PHPUnit\Framework\TestCase;
use ThothClient\GraphQL\Model\Issue;

class IssueTest extends TestCase
final class IssueTest extends TestCase
{
public function testGettersAndSetters(): void
{
Expand Down
28 changes: 28 additions & 0 deletions tests/GraphQL/Model/PriceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace ThothClient\Tests\GraphQL\Model;

use PHPUnit\Framework\TestCase;
use ThothClient\GraphQL\Model\Price;

final class PriceTest extends TestCase
{
public function testGettersAndSetters(): void
{
$priceId = 'f026cdd8-3728-430a-a0d6-af18f8bbe2b7';
$publicationId = '235a8a7b-830a-4828-b231-7e539fb25fcb';
$currentCode = 'USD';
$unitPrice = 12.0;

$price = new Price();
$price->setPriceId($priceId);
$price->setPublicationId($publicationId);
$price->setCurrentCode($currentCode);
$price->setUnitPrice($unitPrice);

$this->assertSame($priceId, $price->getPriceId());
$this->assertSame($publicationId, $price->getPublicationId());
$this->assertSame($currentCode, $price->getCurrentCode());
$this->assertSame($unitPrice, $price->getUnitPrice());
}
}

0 comments on commit 0609cf7

Please sign in to comment.