コード例 #1
0
ファイル: ServiceDefinitionTest.php プロジェクト: tueena/core
 /**
  * @test
  */
 public function The_ServiceDefinition_makes_all_constructor_parameters_available_through_methods()
 {
     // given
     $file = '/my/path';
     $line = 42;
     $IdentifyingType = Type::fromName(__CLASS__);
     $ImplementingType = Type::fromName(__CLASS__);
     $FactoryFunction = function () {
     };
     $InitFunction = function () {
     };
     $Target = new ServiceDefinition($file, $line, IdentifyingType::is($IdentifyingType), ImplementingType::is($ImplementingType), FactoryFunction::is($FactoryFunction), InitFunction::is($InitFunction));
     // when, then
     $this->AssertEquals($file, $Target->getDefiningFilePath());
     $this->AssertEquals($line, $Target->getDefiningLineNumber());
     $this->AssertSame($IdentifyingType, $Target->getIdentifyingType());
     $this->AssertSame($ImplementingType, $Target->getImplementingType());
     $this->AssertSame($FactoryFunction, $Target->getFactoryFunction());
     $this->AssertSame($InitFunction, $Target->getInitFunction());
     $this->AssertTrue($Target->hasFactoryFunction());
     $this->AssertTrue($Target->hasInitFunction());
 }
コード例 #2
0
 /**
  * @param ServiceDefinition $ServiceDefinition
  * @param string $specificMessage
  */
 public function __construct(ServiceDefinition $ServiceDefinition, $specificMessage)
 {
     $message = sprintf("Invalid definition of the service %s in %s on line %d: %s", $ServiceDefinition->getIdentifyingType()->getName(), $ServiceDefinition->getDefiningFilePath(), $ServiceDefinition->getDefiningLineNumber(), $specificMessage);
     parent::__construct($message);
 }