Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions tests/Dto/AccountDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function testConstructorSetsAllProperties(): void

$dto = new AccountDto($data);

$this->assertSame('acc-123', $dto->getId());
$this->assertSame('conn-456', $dto->getConnectionId());
$this->assertSame('My Checking Account', $dto->getName());
$this->assertSame('FR7630001007941234567890185', $dto->getIban());
$this->assertSame(AccountDto::STATUS_ACTIVE, $dto->getStatus());
self::assertSame('acc-123', $dto->getId());
self::assertSame('conn-456', $dto->getConnectionId());
self::assertSame('My Checking Account', $dto->getName());
self::assertSame('FR7630001007941234567890185', $dto->getIban());
self::assertSame(AccountDto::STATUS_ACTIVE, $dto->getStatus());
}

public function testBalanceConvertedToMoneyInCents(): void
Expand All @@ -48,10 +48,10 @@ public function testBalanceConvertedToMoneyInCents(): void

$dto = new AccountDto($data);

$this->assertInstanceOf(Money::class, $dto->getBalance());
$this->assertSame('123456', $dto->getBalance()->getAmount());
$this->assertInstanceOf(Currency::class, $dto->getCurrency());
$this->assertSame('EUR', $dto->getCurrency()->getCode());
self::assertInstanceOf(Money::class, $dto->getBalance());
self::assertSame('123456', $dto->getBalance()->getAmount());
self::assertInstanceOf(Currency::class, $dto->getCurrency());
self::assertSame('EUR', $dto->getCurrency()->getCode());
}

public function testBalanceWithZeroAmount(): void
Expand All @@ -65,7 +65,7 @@ public function testBalanceWithZeroAmount(): void

$dto = new AccountDto($data);

$this->assertSame('0', $dto->getBalance()->getAmount());
self::assertSame('0', $dto->getBalance()->getAmount());
}

public function testBalanceWithNegativeAmount(): void
Expand All @@ -79,7 +79,7 @@ public function testBalanceWithNegativeAmount(): void

$dto = new AccountDto($data);

$this->assertSame('-50025', $dto->getBalance()->getAmount());
self::assertSame('-50025', $dto->getBalance()->getAmount());
}

public function testBalanceRoundingWithMoreThanTwoDecimals(): void
Expand All @@ -93,7 +93,7 @@ public function testBalanceRoundingWithMoreThanTwoDecimals(): void

$dto = new AccountDto($data);

$this->assertSame('10100', $dto->getBalance()->getAmount());
self::assertSame('10100', $dto->getBalance()->getAmount());
}

public function testNameFallsBackToAccountNumber(): void
Expand All @@ -106,7 +106,7 @@ public function testNameFallsBackToAccountNumber(): void

$dto = new AccountDto($data);

$this->assertSame('FR76123456789', $dto->getName());
self::assertSame('FR76123456789', $dto->getName());
}

public function testNameUsedWhenProvided(): void
Expand All @@ -118,7 +118,7 @@ public function testNameUsedWhenProvided(): void

$dto = new AccountDto($data);

$this->assertSame('Primary Account', $dto->getName());
self::assertSame('Primary Account', $dto->getName());
}

public function testIbanIsNullWhenNotProvided(): void
Expand All @@ -128,7 +128,7 @@ public function testIbanIsNullWhenNotProvided(): void

$dto = new AccountDto($data);

$this->assertNull($dto->getIban());
self::assertNull($dto->getIban());
}

public function testDifferentCurrencies(): void
Expand All @@ -145,7 +145,7 @@ public function testDifferentCurrencies(): void

$dto = new AccountDto($data);

$this->assertSame($currencyCode, $dto->getCurrency()->getCode());
self::assertSame($currencyCode, $dto->getCurrency()->getCode());
}
}

Expand All @@ -156,9 +156,9 @@ public function testGetLocalizedStatusReturnsTranslatableMessage(): void
$dto = new AccountDto($data);
$message = $dto->getLocalizedStatus();

$this->assertInstanceOf(TranslatableMessage::class, $message);
$this->assertSame('account_status.ACTIVE', $message->getMessage());
$this->assertSame('linxo', $message->getDomain());
self::assertInstanceOf(TranslatableMessage::class, $message);
self::assertSame('account_status.ACTIVE', $message->getMessage());
self::assertSame('linxo', $message->getDomain());
}

/**
Expand All @@ -170,8 +170,8 @@ public function testAllStatusConstants(string $status): void

$dto = new AccountDto($data);

$this->assertSame($status, $dto->getStatus());
$this->assertSame('account_status.' . $status, $dto->getLocalizedStatus()->getMessage());
self::assertSame($status, $dto->getStatus());
self::assertSame('account_status.' . $status, $dto->getLocalizedStatus()->getMessage());
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/Dto/ConnectionDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function testConstructorSetsAllProperties(): void

$dto = new ConnectionDto($data);

$this->assertSame('conn-123', $dto->getId());
$this->assertSame('BNP Paribas', $dto->getName());
$this->assertSame(ConnectionDto::STATUS_SUCCESS, $dto->getStatus());
$this->assertSame('https://example.com/bnp-logo.png', $dto->getLogoUrl());
self::assertSame('conn-123', $dto->getId());
self::assertSame('BNP Paribas', $dto->getName());
self::assertSame(ConnectionDto::STATUS_SUCCESS, $dto->getStatus());
self::assertSame('https://example.com/bnp-logo.png', $dto->getLogoUrl());
}

/**
Expand All @@ -35,7 +35,7 @@ public function testAllStatusConstants(string $status): void

$dto = new ConnectionDto($data);

$this->assertSame($status, $dto->getStatus());
self::assertSame($status, $dto->getStatus());
}

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testDifferentBankNames(): void

$dto = new ConnectionDto($data);

$this->assertSame($bankName, $dto->getName());
self::assertSame($bankName, $dto->getName());
}
}

Expand All @@ -82,7 +82,7 @@ public function testLogoUrlWithVariousFormats(): void

$dto = new ConnectionDto($data);

$this->assertSame($logoUrl, $dto->getLogoUrl());
self::assertSame($logoUrl, $dto->getLogoUrl());
}
}

Expand Down
42 changes: 21 additions & 21 deletions tests/Dto/TransactionDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function testConstructorSetsAllProperties(): void

$dto = new TransactionDto($data);

$this->assertSame('txn-123', $dto->getId());
$this->assertSame('acc-456', $dto->getAccountId());
$this->assertSame('Grocery Store Purchase', $dto->getLabel());
$this->assertSame('Weekly groceries', $dto->getNotes());
$this->assertSame(TransactionDto::TYPE_POINT_OF_SALE, $dto->getType());
self::assertSame('txn-123', $dto->getId());
self::assertSame('acc-456', $dto->getAccountId());
self::assertSame('Grocery Store Purchase', $dto->getLabel());
self::assertSame('Weekly groceries', $dto->getNotes());
self::assertSame(TransactionDto::TYPE_POINT_OF_SALE, $dto->getType());
}

public function testAmountConvertedToMoneyInCents(): void
Expand All @@ -47,10 +47,10 @@ public function testAmountConvertedToMoneyInCents(): void

$dto = new TransactionDto($data);

$this->assertInstanceOf(Money::class, $dto->getAmount());
$this->assertSame('123456', $dto->getAmount()->getAmount());
$this->assertInstanceOf(Currency::class, $dto->getAmount()->getCurrency());
$this->assertSame('EUR', $dto->getAmount()->getCurrency()->getCode());
self::assertInstanceOf(Money::class, $dto->getAmount());
self::assertSame('123456', $dto->getAmount()->getAmount());
self::assertInstanceOf(Currency::class, $dto->getAmount()->getCurrency());
self::assertSame('EUR', $dto->getAmount()->getCurrency()->getCode());
}

public function testAmountWithNegativeValue(): void
Expand All @@ -62,7 +62,7 @@ public function testAmountWithNegativeValue(): void

$dto = new TransactionDto($data);

$this->assertSame('-9999', $dto->getAmount()->getAmount());
self::assertSame('-9999', $dto->getAmount()->getAmount());
}

public function testAmountWithZeroValue(): void
Expand All @@ -74,7 +74,7 @@ public function testAmountWithZeroValue(): void

$dto = new TransactionDto($data);

$this->assertSame('0', $dto->getAmount()->getAmount());
self::assertSame('0', $dto->getAmount()->getAmount());
}

public function testAmountRoundingWithMoreThanTwoDecimals(): void
Expand All @@ -86,7 +86,7 @@ public function testAmountRoundingWithMoreThanTwoDecimals(): void

$dto = new TransactionDto($data);

$this->assertSame('5056', $dto->getAmount()->getAmount());
self::assertSame('5056', $dto->getAmount()->getAmount());
}

public function testTypeFallsBackToOtherWhenNotProvided(): void
Expand All @@ -96,7 +96,7 @@ public function testTypeFallsBackToOtherWhenNotProvided(): void

$dto = new TransactionDto($data);

$this->assertSame(TransactionDto::TYPE_OTHER, $dto->getType());
self::assertSame(TransactionDto::TYPE_OTHER, $dto->getType());
}

public function testLabelIsNullWhenNotProvided(): void
Expand All @@ -106,7 +106,7 @@ public function testLabelIsNullWhenNotProvided(): void

$dto = new TransactionDto($data);

$this->assertNull($dto->getLabel());
self::assertNull($dto->getLabel());
}

public function testNotesIsNullWhenNotProvided(): void
Expand All @@ -116,7 +116,7 @@ public function testNotesIsNullWhenNotProvided(): void

$dto = new TransactionDto($data);

$this->assertNull($dto->getNotes());
self::assertNull($dto->getNotes());
}

public function testDateParsedAsAbsoluteDate(): void
Expand All @@ -128,13 +128,13 @@ public function testDateParsedAsAbsoluteDate(): void

$dto = new TransactionDto($data);

$this->assertInstanceOf(AbsoluteDate::class, $dto->getDate());
$this->assertSame('2024-06-20', $dto->getDate()->__toString());
self::assertInstanceOf(AbsoluteDate::class, $dto->getDate());
self::assertSame('2024-06-20', $dto->getDate()->__toString());
}

public function testDateUsesEuropeParisTimezone(): void
{
$this->assertSame('Europe/Paris', TransactionDto::TIMEZONE);
self::assertSame('Europe/Paris', TransactionDto::TIMEZONE);

// Test a date that would be different in UTC vs Europe/Paris
// 2024-01-15T23:30:00Z (UTC) is 2024-01-16T00:30:00 in Paris (winter time, UTC+1)
Expand All @@ -146,7 +146,7 @@ public function testDateUsesEuropeParisTimezone(): void
$dto = new TransactionDto($data);

// In Europe/Paris, this would be the next day
$this->assertSame('2024-01-16', $dto->getDate()->__toString());
self::assertSame('2024-01-16', $dto->getDate()->__toString());
}

public function testDifferentCurrencies(): void
Expand All @@ -161,7 +161,7 @@ public function testDifferentCurrencies(): void

$dto = new TransactionDto($data);

$this->assertSame($currencyCode, $dto->getAmount()->getCurrency()->getCode());
self::assertSame($currencyCode, $dto->getAmount()->getCurrency()->getCode());
}
}

Expand All @@ -174,7 +174,7 @@ public function testAllTransactionTypeConstants(string $type): void

$dto = new TransactionDto($data);

$this->assertSame($type, $dto->getType());
self::assertSame($type, $dto->getType());
}

/**
Expand Down
28 changes: 14 additions & 14 deletions tests/Dto/UserDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public function testConstructorSetsAllProperties(): void

$dto = new UserDto($data);

$this->assertSame('user-123', $dto->getId());
$this->assertSame('john.doe@example.com', $dto->getEmail());
$this->assertSame('John', $dto->getFirstname());
$this->assertSame('Doe', $dto->getLastname());
$this->assertInstanceOf(\DateTimeImmutable::class, $dto->getCreatedAt());
$this->assertSame($creationTimestamp, $dto->getCreatedAt()->getTimestamp());
self::assertSame('user-123', $dto->getId());
self::assertSame('john.doe@example.com', $dto->getEmail());
self::assertSame('John', $dto->getFirstname());
self::assertSame('Doe', $dto->getLastname());
self::assertInstanceOf(\DateTimeImmutable::class, $dto->getCreatedAt());
self::assertSame($creationTimestamp, $dto->getCreatedAt()->getTimestamp());
}

public function testFirstnameIsNullWhenNotProvided(): void
Expand All @@ -37,7 +37,7 @@ public function testFirstnameIsNullWhenNotProvided(): void

$dto = new UserDto($data);

$this->assertNull($dto->getFirstname());
self::assertNull($dto->getFirstname());
}

public function testLastnameIsNullWhenNotProvided(): void
Expand All @@ -47,7 +47,7 @@ public function testLastnameIsNullWhenNotProvided(): void

$dto = new UserDto($data);

$this->assertNull($dto->getLastname());
self::assertNull($dto->getLastname());
}

public function testBothNamesNullWhenNotProvided(): void
Expand All @@ -57,8 +57,8 @@ public function testBothNamesNullWhenNotProvided(): void

$dto = new UserDto($data);

$this->assertNull($dto->getFirstname());
$this->assertNull($dto->getLastname());
self::assertNull($dto->getFirstname());
self::assertNull($dto->getLastname());
}

public function testCreatedAtParsedFromUnixTimestamp(): void
Expand All @@ -68,8 +68,8 @@ public function testCreatedAtParsedFromUnixTimestamp(): void

$dto = new UserDto($data);

$this->assertSame('2021-01-01', $dto->getCreatedAt()->format('Y-m-d'));
$this->assertSame($timestamp, $dto->getCreatedAt()->getTimestamp());
self::assertSame('2021-01-01', $dto->getCreatedAt()->format('Y-m-d'));
self::assertSame($timestamp, $dto->getCreatedAt()->getTimestamp());
}

public function testCreatedAtWithRecentTimestamp(): void
Expand All @@ -79,7 +79,7 @@ public function testCreatedAtWithRecentTimestamp(): void

$dto = new UserDto($data);

$this->assertSame('2024-01-01', $dto->getCreatedAt()->format('Y-m-d'));
self::assertSame('2024-01-01', $dto->getCreatedAt()->format('Y-m-d'));
}

public function testEmailWithVariousFormats(): void
Expand All @@ -96,7 +96,7 @@ public function testEmailWithVariousFormats(): void

$dto = new UserDto($data);

$this->assertSame($email, $dto->getEmail());
self::assertSame($email, $dto->getEmail());
}
}

Expand Down
Loading