public function testMatch() { $type = new BindingTypeDescriptor('vendor/type', null, array(new BindingParameterDescriptor('param'))); $type->load($this->package); $uuid = Uuid::fromString('abcdb814-9dad-11d1-80b4-00c04fd430c8'); $this->package->getInstallInfo()->addEnabledBindingUuid($uuid); $binding = new BindingDescriptor('/path', 'vendor/type', array('param' => 'value'), 'glob', $uuid); $binding->load($this->package, $type); $this->assertFalse($binding->match(Expr::same('foobar', BindingDescriptor::CONTAINING_PACKAGE))); $this->assertTrue($binding->match(Expr::same($this->package->getName(), BindingDescriptor::CONTAINING_PACKAGE))); $this->assertFalse($binding->match(Expr::same(BindingState::DISABLED, BindingDescriptor::STATE))); $this->assertTrue($binding->match(Expr::same(BindingState::ENABLED, BindingDescriptor::STATE))); $this->assertFalse($binding->match(Expr::startsWith('abce', BindingDescriptor::UUID))); $this->assertTrue($binding->match(Expr::startsWith('abcd', BindingDescriptor::UUID))); $this->assertFalse($binding->match(Expr::same('/path/nested', BindingDescriptor::QUERY))); $this->assertTrue($binding->match(Expr::same('/path', BindingDescriptor::QUERY))); $this->assertFalse($binding->match(Expr::same('xpath', BindingDescriptor::LANGUAGE))); $this->assertTrue($binding->match(Expr::same('glob', BindingDescriptor::LANGUAGE))); $this->assertFalse($binding->match(Expr::same('vendor/other', BindingDescriptor::TYPE_NAME))); $this->assertTrue($binding->match(Expr::same('vendor/type', BindingDescriptor::TYPE_NAME))); $this->assertFalse($binding->match(Expr::key(BindingDescriptor::PARAMETER_VALUES, Expr::key('param', Expr::same('foobar'))))); $this->assertTrue($binding->match(Expr::key(BindingDescriptor::PARAMETER_VALUES, Expr::key('param', Expr::same('value'))))); }