예제 #1
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage The type "my/type" does not exist in the package "vendor/root".
  */
 public function testDeleteTypeFailsIfNotFound()
 {
     $args = self::$deleteCommand->parseArgs(new StringArgs('my/type'));
     $this->discoveryManager->expects($this->once())->method('hasRootBindingType')->with('my/type')->willReturn(false);
     $this->discoveryManager->expects($this->never())->method('removeRootBindingType');
     $this->assertSame(0, $this->handler->handleRemove($args));
 }
예제 #2
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Invalid build target "foobar". Expected one of: "all", "factory", "repository", "discovery"
  */
 public function testBuildFailsIfInvalidTarget()
 {
     $args = self::$buildCommand->parseArgs(new StringArgs('foobar'));
     $this->factoryManager->expects($this->never())->method('autoGenerateFactoryClass');
     $this->repoManager->expects($this->never())->method('clearRepository');
     $this->repoManager->expects($this->never())->method('buildRepository');
     $this->discoveryManager->expects($this->never())->method('clearDiscovery');
     $this->discoveryManager->expects($this->never())->method('buildDiscovery');
     $this->handler->handle($args);
 }
 public function testHasRootAssetMappingsWithExpression()
 {
     $this->discoveryManager->expects($this->once())->method('hasRootBindings')->with($this->webPath('/path'))->willReturn(true);
     $expr = Expr::same('/path', AssetMapping::SERVER_PATH);
     $this->assertTrue($this->manager->hasRootAssetMappings($expr));
 }
예제 #4
0
 private function initDefaultBindings()
 {
     $this->discoveryManager->expects($this->any())->method('findBindings')->willReturnCallback($this->returnFromMap(array(array($this->packageAndState('vendor/root', BindingState::ENABLED), array(new BindingDescriptor('/root/enabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID1)), new BindingDescriptor('/overridden', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID2)))), array($this->packageAndState('vendor/root', BindingState::DISABLED), array(new BindingDescriptor('/root/disabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID3)))), array($this->packageAndState('vendor/root', BindingState::UNDECIDED), array(new BindingDescriptor('/root/undecided', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID4)))), array($this->packageAndState('vendor/root', BindingState::TYPE_NOT_FOUND), array(new BindingDescriptor('/root/type-not-found', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID5)))), array($this->packageAndState('vendor/root', BindingState::TYPE_NOT_ENABLED), array(new BindingDescriptor('/root/type-not-enabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID17)))), array($this->packageAndState('vendor/root', BindingState::INVALID), array(new BindingDescriptor('/root/invalid', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID6)))), array($this->packageAndState('vendor/package1', BindingState::ENABLED), array(new BindingDescriptor('/package1/enabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID7)))), array($this->packageAndState('vendor/package1', BindingState::DISABLED), array(new BindingDescriptor('/package1/disabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID8)))), array($this->packageAndState('vendor/package1', BindingState::UNDECIDED), array(new BindingDescriptor('/package1/undecided', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID9)))), array($this->packageAndState('vendor/package1', BindingState::TYPE_NOT_FOUND), array(new BindingDescriptor('/package1/type-not-found', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID10)))), array($this->packageAndState('vendor/package1', BindingState::TYPE_NOT_ENABLED), array(new BindingDescriptor('/package1/type-not-enable', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID18)))), array($this->packageAndState('vendor/package1', BindingState::INVALID), array(new BindingDescriptor('/package1/invalid', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID11)))), array($this->packageAndState('vendor/package2', BindingState::ENABLED), array(new BindingDescriptor('/package2/enabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID12)))), array($this->packageAndState('vendor/package2', BindingState::DISABLED), array(new BindingDescriptor('/package2/disabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID13)))), array($this->packageAndState('vendor/package2', BindingState::UNDECIDED), array(new BindingDescriptor('/package2/undecided', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID14)))), array($this->packageAndState('vendor/package2', BindingState::TYPE_NOT_FOUND), array(new BindingDescriptor('/package2/type-not-found', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID15)))), array($this->packageAndState('vendor/package2', BindingState::TYPE_NOT_ENABLED), array(new BindingDescriptor('/package2/type-not-enabled', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID19)))), array($this->packageAndState('vendor/package2', BindingState::INVALID), array(new BindingDescriptor('/package2/invalid', 'my/type', array(), 'glob', Uuid::fromString(self::BINDING_UUID16)))))));
 }