@@ -15,15 +15,15 @@ Assert::exception(function () {
1515 $ builder = new DI \ContainerBuilder ;
1616 $ builder ->addDefinition ('one ' )->setClass ('X ' )->setFactory ('Unknown ' );
1717 $ builder ->generateClasses ();
18- }, Nette \InvalidStateException::class, "Class Unknown used in service 'one' not found or is not instantiable . " );
18+ }, Nette \InvalidStateException::class, "Class Unknown used in service 'one' not found. " );
1919
2020
2121Assert::exception (function () {
2222 $ builder = new DI \ContainerBuilder ;
2323 $ builder ->addDefinition ('one ' )->setFactory ('@two ' );
2424 $ builder ->addDefinition ('two ' )->setFactory ('Unknown ' );
2525 $ builder ->generateClasses ();
26- }, Nette \InvalidStateException::class, "Class Unknown used in service 'two' not found or is not instantiable . " );
26+ }, Nette \InvalidStateException::class, "Class Unknown used in service 'two' not found. " );
2727
2828
2929Assert::exception (function () {
@@ -132,3 +132,29 @@ Assert::error(function () {
132132 $ builder ->addDefinition ('one ' )->setFactory ('Bad7::create ' );
133133 $ builder ->generateClasses ();
134134}, E_USER_NOTICE , "Type of service 'one' is unknown. " );
135+
136+
137+ class Bad8
138+ {
139+ private function __construct ()
140+ {}
141+ }
142+
143+ Assert::exception (function () {
144+ $ builder = new DI \ContainerBuilder ;
145+ $ builder ->addDefinition ('one ' )->setClass ('Bad8 ' );
146+ $ builder ->generateClasses ();
147+ }, Nette \InvalidStateException::class, "Class Bad8 used in service 'one' has private constructor. " );
148+
149+
150+ abstract class Bad9
151+ {
152+ protected function __construct ()
153+ {}
154+ }
155+
156+ Assert::exception (function () {
157+ $ builder = new DI \ContainerBuilder ;
158+ $ builder ->addDefinition ('one ' )->setClass ('Bad9 ' );
159+ $ builder ->generateClasses ();
160+ }, Nette \InvalidStateException::class, "Class Bad9 used in service 'one' is abstract. " );
0 commit comments