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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Tiny Blocks
Copyright (c) 2022-2023 Tiny Blocks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/ValueObjectAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait ValueObjectAdapter
{
public function values(): array
{
return get_object_vars($this);
return get_object_vars(object: $this);
}

public function equals(ValueObject $other): bool
Expand Down
14 changes: 8 additions & 6 deletions tests/ComplexValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testWhenEqualIsFalse(): void
public function testInvalidProperty(): void
{
$this->expectException(InvalidProperty::class);
$this->expectErrorMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\ComplexValueMock>.');
$this->expectExceptionMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\ComplexValueMock>.');

$complex = new ComplexValueMock(
single: new SingleValueMock(id: 1000),
Expand All @@ -86,13 +86,15 @@ public function testInvalidProperty(): void
]
)
);
$complex->__get('other');
$complex->__get(key: 'other');
}

public function testPropertyCannotBeChanged(): void
{
$this->expectException(PropertyCannotBeChanged::class);
$this->expectErrorMessage('Property <other> cannot be changed in class <TinyBlocks\Vo\Mock\ComplexValueMock>.');
$this->expectExceptionMessage(
'Property <other> cannot be changed in class <TinyBlocks\Vo\Mock\ComplexValueMock>.'
);

$complex = new ComplexValueMock(
single: new SingleValueMock(id: 1000),
Expand All @@ -104,13 +106,13 @@ public function testPropertyCannotBeChanged(): void
]
)
);
$complex->__set('other', new StdClass());
$complex->__set(key: 'other', value: new StdClass());
}

public function testPropertyCannotBeDeactivated(): void
{
$this->expectException(PropertyCannotBeDeactivated::class);
$this->expectErrorMessage(
$this->expectExceptionMessage(
'Property <other> cannot be deactivated in class <TinyBlocks\Vo\Mock\ComplexValueMock>.'
);

Expand All @@ -124,6 +126,6 @@ public function testPropertyCannotBeDeactivated(): void
]
)
);
$complex->__unset('other');
$complex->__unset(key: 'other');
}
}
12 changes: 6 additions & 6 deletions tests/MultipleValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testWhenEqualIsFalse(): void
public function testInvalidProperty(): void
{
$this->expectException(InvalidProperty::class);
$this->expectErrorMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\MultipleValueMock>.');
$this->expectExceptionMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\MultipleValueMock>.');

$multiple = new MultipleValueMock(
id: 123,
Expand All @@ -69,13 +69,13 @@ public function testInvalidProperty(): void
new TransactionMock(id: 200, amount: new AmountMock(value: 11.01, currency: 'BRL'))
]
);
$multiple->__get('other');
$multiple->__get(key: 'other');
}

public function testPropertyCannotBeChanged(): void
{
$this->expectException(PropertyCannotBeChanged::class);
$this->expectErrorMessage(
$this->expectExceptionMessage(
'Property <other> cannot be changed in class <TinyBlocks\Vo\Mock\MultipleValueMock>.'
);

Expand All @@ -86,13 +86,13 @@ public function testPropertyCannotBeChanged(): void
new TransactionMock(id: 200, amount: new AmountMock(value: 11.01, currency: 'BRL'))
]
);
$multiple->__set('other', new StdClass());
$multiple->__set(key: 'other', value: new StdClass());
}

public function testPropertyCannotBeDeactivated(): void
{
$this->expectException(PropertyCannotBeDeactivated::class);
$this->expectErrorMessage(
$this->expectExceptionMessage(
'Property <other> cannot be deactivated in class <TinyBlocks\Vo\Mock\MultipleValueMock>.'
);

Expand All @@ -103,6 +103,6 @@ public function testPropertyCannotBeDeactivated(): void
new TransactionMock(id: 200, amount: new AmountMock(value: 11.01, currency: 'BRL'))
]
);
$multiple->__unset('other');
$multiple->__unset(key: 'other');
}
}
14 changes: 8 additions & 6 deletions tests/SingleValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,34 @@ public function testWhenEqualIsFalse(): void
public function testInvalidProperty(): void
{
$this->expectException(InvalidProperty::class);
$this->expectErrorMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\SingleValueMock>.');
$this->expectExceptionMessage('Invalid property <other> for class <TinyBlocks\Vo\Mock\SingleValueMock>.');

$single = new SingleValueMock(id: 1);

$single->__get('other');
$single->__get(key: 'other');
}

public function testPropertyCannotBeChanged(): void
{
$this->expectException(PropertyCannotBeChanged::class);
$this->expectErrorMessage('Property <other> cannot be changed in class <TinyBlocks\Vo\Mock\SingleValueMock>.');
$this->expectExceptionMessage(
'Property <other> cannot be changed in class <TinyBlocks\Vo\Mock\SingleValueMock>.'
);

$single = new SingleValueMock(id: 1);

$single->__set('other', new StdClass());
$single->__set(key: 'other', value: new StdClass());
}

public function testPropertyCannotBeDeactivated(): void
{
$this->expectException(PropertyCannotBeDeactivated::class);
$this->expectErrorMessage(
$this->expectExceptionMessage(
'Property <other> cannot be deactivated in class <TinyBlocks\Vo\Mock\SingleValueMock>.'
);

$single = new SingleValueMock(id: 1);

$single->__unset('other');
$single->__unset(key: 'other');
}
}