Пример #1
0
 public function testRegistration()
 {
     $test = ['command' => '\\stdClass', 'command1' => '\\stdClass'];
     $this->appMock->expects($this->any())->method('singleton')->will($this->returnCallback(function ($command, $callback) use($test) {
         $commandName = str_replace($this->testInstance->getIoCRegistry() . ".", '', $command);
         $this->assertArrayHasKey($commandName, $test);
         $this->assertTrue($callback($this->appMock) instanceof $test[$commandName]);
     }));
     $this->testInstance->registerNamespaces($test);
     $this->appMock->expects($this->any())->method('make')->will($this->returnValue($this));
     $this->assertSame($this, $this->testInstance->getNamespace('command'));
     try {
         $this->testInstance->getNamespace($command = uniqid('not_existent'));
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof \UnexpectedValueException);
         $this->assertSame("Unknown blade command namespace - {$command}.", $e->getMessage());
     }
 }