/**
  * @param \Spryker\Zed\Kernel\ClassResolver\ClassInfo $callerClassInfo
  * @param string $key
  *
  * @return string
  */
 protected function buildMessage(ClassInfo $callerClassInfo, $key)
 {
     $message = 'Spryker Kernel Exception' . PHP_EOL;
     $message .= sprintf('Container does not contain the called "%s"', $key) . PHP_EOL;
     $message .= sprintf('You can fix this by adding the key "%s" to your "%sDependencyProvider"', $key, $callerClassInfo->getBundle());
     return $message;
 }
예제 #2
0
 /**
  * @param \Spryker\Zed\Kernel\ClassResolver\ClassInfo $callerClassInfo
  *
  * @return string
  */
 protected function buildMessage(ClassInfo $callerClassInfo)
 {
     $message = 'Spryker Kernel Exception' . PHP_EOL;
     $message .= sprintf('Can not resolve $1Facade in Business layer for your bundle "%s"', $callerClassInfo->getBundle()) . PHP_EOL;
     $message .= 'You can fix this by adding the missing Facade to your bundle.' . PHP_EOL;
     $message .= sprintf('E.g. %s\\Zed\\%2$s\\Business\\%2$sFacade', Config::getInstance()->get(KernelConstants::PROJECT_NAMESPACE), $callerClassInfo->getBundle());
     $message .= new Backtrace();
     return $message;
 }
 /**
  * @param \Spryker\Zed\Kernel\ClassResolver\ClassInfo $callerClassInfo
  *
  * @return string
  */
 protected function buildMessage(ClassInfo $callerClassInfo)
 {
     $message = 'Spryker Kernel Exception' . PHP_EOL;
     $message .= sprintf('Can not resolve %1$sDependencyProvider for your bundle "%1$s"', $callerClassInfo->getBundle()) . PHP_EOL;
     $message .= 'You can fix this by adding the missing DependencyProvider to your bundle.' . PHP_EOL;
     $message .= sprintf('E.g. %s\\Zed\\%2$s\\%2$sDependencyProvider', Config::getInstance()->get(KernelConstants::PROJECT_NAMESPACE), $callerClassInfo->getBundle());
     $message .= PHP_EOL . new Backtrace();
     return $message;
 }
예제 #4
0
 /**
  * @return void
  */
 public function testGetQueryContainerThrowExceptionIfQueryContainerNotFound()
 {
     $this->expectException(QueryContainerNotFoundException::class);
     $queryContainerResolverMock = $this->getMockBuilder(QueryContainerResolver::class)->setMethods(['canResolve', 'getClassInfo'])->getMock();
     $queryContainerResolverMock->method('canResolve')->willReturn(false);
     $classInfo = new ClassInfo();
     $classInfo->setClass('\\Namespace\\Application\\Bundle\\Layer\\Foo\\Bar');
     $queryContainerResolverMock->method('getClassInfo')->willReturn($classInfo);
     $pluginMock = $this->getPluginMock(['getQueryContainerResolver']);
     $pluginMock->method('getQueryContainerResolver')->willReturn($queryContainerResolverMock);
     $pluginMock->getQueryContainer();
 }
예제 #5
0
 /**
  * @return void
  */
 public function testSetClassNameMustExtractLayerFromClass()
 {
     $classInfo = new ClassInfo();
     $classInfo->setClass($classInfo);
     $this->assertSame('ClassResolver', $classInfo->getLayer());
 }
예제 #6
0
 /**
  * @param object|string $callerClass
  *
  * @return \Spryker\Zed\Kernel\ClassResolver\AbstractClassResolver
  */
 public function setCallerClass($callerClass)
 {
     $this->classInfo = new ClassInfo();
     $this->classInfo->setClass($callerClass);
     return $this;
 }