Skip to content

Commit 589497d

Browse files
committed
MC-33898: Uninformative exception message when di compile fails due to not existed dependency
1 parent f146128 commit 589497d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/internal/Magento/Framework/Code/Test/Unit/Reader/ClassReaderTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,27 @@ public function testGetParents()
6060
);
6161
}
6262

63+
/**
64+
* Check that while processing nonexistent argument of constructor exception message contains original class name
65+
*/
66+
public function testGetConstructorWithNonexistentDependency()
67+
{
68+
$testClass = new class {
69+
private $arg;
70+
71+
// phpstan:ignore
72+
public function __construct(?\NonexistentDependency $arg = null)
73+
{
74+
$this->arg = $arg;
75+
}
76+
};
77+
78+
$className = get_class($testClass);
79+
$this->expectException(\ReflectionException::class);
80+
$this->expectExceptionMessage($className);
81+
$this->model->getConstructor($className);
82+
}
83+
6384
/**
6485
* Data provider
6586
*

0 commit comments

Comments
 (0)