Example #1
0
 function it_should_filter_on_to_account()
 {
     $this->addTransaction(Transaction::createNew('20150730', 'This is a shorter description that is really long', '0987654321', '1234567890', "GT", "30,00", "This is a description"));
     $this->transactionsTo(Account::fromNumber("0987654321"))->count()->shouldBe(1);
     $this->transactionsFrom(Account::fromNumber("0987654321"))->count()->shouldBe(0);
 }
Example #2
0
 public function replay(Stream $stream)
 {
     /** @var Event $event */
     foreach ($stream->replay() as $event) {
         switch (get_class($event)) {
             case TransactionWasCreated::class:
                 $this->id = Id::fromString($event->getId());
                 $this->date = Date::fromString($event->getDate());
                 $this->from = Account::fromNumber($event->getFrom());
                 $this->to = Account::withName($event->getTo(), $event->getName());
                 $this->code = Code::fromString($event->getCode());
                 $this->amount = Amount::fromString($event->getAmount());
                 $this->description = Description::fromString($event->getDescription());
                 break;
             case TransactionWasAttachedToCategory::class:
                 $this->categories[] = $event->getCategoryId();
                 break;
         }
     }
     return $this;
 }
Example #3
0
 function it_can_compare_account()
 {
     $this->equals(Account::fromNumber('0987654321'))->shouldReturn(true);
 }