File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919trait EventTrait
2020{
21+ /**
22+ * @codeCoverageIgnore
23+ */
24+ private function __construct ()
25+ {
26+ }
27+
2128 public function __call (string $ method , array $ parameters )
2229 {
2330 return Dispatcher::invoke (
Original file line number Diff line number Diff line change 1515use ScaleUpStack \EasyObject \Tests \Resources \Traits \ForEventTraitTesting ;
1616use ScaleUpStack \EasyObject \Traits \EventTrait ;
1717use ScaleUpStack \EasyObject \Tests \Resources \TestCase ;
18+ use ScaleUpStack \Reflection \Reflection ;
1819
1920/**
2021 * @coversDefaultClass \ScaleUpStack\EasyObject\Traits\EventTrait
@@ -37,4 +38,16 @@ public function it_uses_magic_methods_for_named_constructor_and_virtual_getters(
3738 // then the property is accessible via the virtual getter
3839 $ this ->assertSame ($ someProperty , $ event ->someProperty ());
3940 }
41+
42+ /**
43+ * @test
44+ */
45+ public function it_cannot_be_constructed_via_new ()
46+ {
47+ // the constructor must not be public
48+ $ this ->assertFalse (
49+ Reflection::methodOfClass (ForEventTraitTesting::class, '__construct ' )->isPublic (),
50+ '__construct() must not be public '
51+ );
52+ }
4053}
You can’t perform that action at this time.
0 commit comments