コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getRelationship()
 {
     $plugin_definition = $this->getPluginDefinition();
     $context_definition = new ContextDefinition("language", $plugin_definition['label']);
     $context_value = NULL;
     // If the 'base' context has a value, then get the property value to put on
     // the context (otherwise, mapping hasn't occurred yet and we just want to
     // return the context with the right definition and no value).
     if ($this->getContext('base')->hasContextValue()) {
         $context_value = $this->getData($this->getContext('base'))->language;
     }
     $context_definition->setDefaultValue($context_value);
     return new Context($context_definition, $context_value);
 }
コード例 #2
0
 /**
  * @covers ::getDefaultValue
  * @covers ::setDefaultValue
  */
 public function testDefaultValue()
 {
     $context_definition = new ContextDefinition();
     $this->assertNull($context_definition->getDefaultValue());
     $context_definition->setDefaultValue('test');
     $this->assertSame('test', $context_definition->getDefaultValue());
 }