Skip to content

Commit 1935909

Browse files
committed
Start describing the transaction feature
1 parent b383405 commit 1935909

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

behat.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ default:
99
- %paths.base%/features/equity
1010
contexts:
1111
- PerFiFeatureTest\Domain\Equity\OpeningBalanceContext
12+
1213
account:
1314
paths:
1415
- %paths.base%/features/account.feature
1516
contexts:
1617
- PerFiFeatureTest\Domain\AccountContext
18+
19+
transaction:
20+
paths:
21+
- %paths.base%/features/transaction.feature
22+
contexts:
23+
- PerFiFeatureTest\Domain\TransactionContext

features/transaction.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,17 @@ Feature: Transactions
1010
charges an amount to the destination account
1111

1212
These two transactions are each other's inverse transactions.
13+
14+
Scenario: A paying transaction between two accounts
15+
Given I have an asset account called "Cash"
16+
And I have an expense account called "Groceries"
17+
When 1200 RSD is payed for "supermarket groceries" from "Cash" to "Groceries"
18+
Then I should have 1200 RSD funds less in "Cash" asset account
19+
And I should have 1200 RSD funds more in "Groceries" expense account
20+
21+
Scenario: A charging transaction between two accounts
22+
Given I have an asset account called "Cash"
23+
And I have an expense account called "Groceries"
24+
When 1200 RSD is charged for "supermarket groceries" from "Groceries" to "Cash"
25+
Then I should have 1200 RSD funds less in "Cash" asset account
26+
And I should have 1200 RSD funds more in "Groceries" expense account

tests/PerFiFeatureTest/Domain/AccountContext.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace PerFiFeatureTest\Domain;
55

66
use Behat\Behat\Context\Context;
7-
use Behat\Behat\Tester\Exception\PendingException;
87
use PerFi\Application\Account\InMemoryAccountRepository;
98
use PerFi\Domain\Account\Account;
109
use PerFi\Domain\Account\CommandHandler\CreateAccount as CreateAccountCommandHandler;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace PerFiFeatureTest\Domain;
5+
6+
use Behat\Behat\Context\Context;
7+
use Behat\Behat\Tester\Exception\PendingException;
8+
9+
class TransactionContext implements Context
10+
{
11+
/**
12+
* @Given I have an :type account called :title
13+
*/
14+
public function iHaveAnAccountOfCertianTypeCalled($type, $title)
15+
{
16+
throw new PendingException();
17+
}
18+
19+
/**
20+
* @When :amount :currency is payed for :description from :source to :destination
21+
*/
22+
public function anAmountInCurrencyIsPayedForSomething($amount, $currency, $description, $source, $destination)
23+
{
24+
throw new PendingException();
25+
}
26+
27+
/**
28+
* @When :amount :currency is charged for :description from :source to :destination
29+
*/
30+
public function anAmountInCurrencyIsChargedForSomething($amount, $currency, $description, $source, $destination)
31+
{
32+
throw new PendingException();
33+
}
34+
35+
/**
36+
* @Then I should have :amount :currency funds less in :title :type account
37+
*/
38+
public function iShouldHaveLessFundsInSourceAccount($amount, $currency, $title, $type)
39+
{
40+
throw new PendingException();
41+
}
42+
43+
/**
44+
* @Then I should have :amount :currency funds more in :title :type account
45+
*/
46+
public function iShouldHaveMoreFundsInDestinationAccount($amount, $currency, $title, $type)
47+
{
48+
throw new PendingException();
49+
}
50+
}

0 commit comments

Comments
 (0)