File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,12 @@ public function withProviders(array $providers = []): self
5353 * @param array $singletons
5454 * @return $this
5555 */
56- public function withSingletons (array $ singletons ): self
56+ public function withSingletons (array $ singletons = [] ): self
5757 {
58+ if (empty ($ singletons )) {
59+ return $ this ;
60+ }
61+
5862 $ this ->registered (function ($ app ) use ($ singletons ) {
5963 foreach ($ singletons as $ key => $ callable ) {
6064 $ app ->singleton ($ key , $ callable );
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- use Codefy \Framework \Configuration \ ApplicationBuilder ;
5+ use Codefy \Framework \Application ;
66use Codefy \Framework \Pipeline \Pipeline ;
77use Codefy \Framework \Pipeline \PipelineBuilder ;
88use Codefy \Framework \tests \Pipes \PipeFour ;
1111use Codefy \Framework \tests \Pipes \PipeTwo ;
1212use PHPUnit \Framework \Assert ;
1313
14- /** @var ApplicationBuilder $app */
14+ /** @var Application $app */
1515$ app = require_once __DIR__ . '/../vendor/bootstrap.php ' ;
1616
17- $ pipeline = new Pipeline ($ app-> return () );
17+ $ pipeline = new Pipeline ($ app );
1818
1919it ('has exception handled by onFailure method. ' , function () use ($ pipeline ) {
2020 $ result = $ pipeline
Original file line number Diff line number Diff line change 44use Qubus \Exception \Data \TypeException ;
55
66try {
7- return Application::configure (['basePath ' => dirname (path: __DIR__ , levels: 2 )]);
7+ return Application::configure (['basePath ' => dirname (path: __DIR__ , levels: 2 )])
8+ ->withProviders ([
9+ // fill in custom providers
10+ ])
11+ ->withSingletons ([
12+ // fill in custom singletons
13+ ])
14+ ->return ();
815} catch (TypeException $ e ) {
916 return $ e ->getMessage ();
1017}
You can’t perform that action at this time.
0 commit comments