Пример #1
0
 /**
  * Adds a #Const directive to the ManiaScript.
  * @param string $name The name of the constant.
  * @param string $value The value of the constant.
  * @return $this Implementing fluent interface.
  */
 public function addConstant($name, $value)
 {
     $constant = new Constant();
     $constant->setName($name)->setValue($value);
     $this->builder->addDirective($constant);
     return $this;
 }
Пример #2
0
 /**
  * Tests the setValue() method.
  * @covers \ManiaScript\Builder\Directive\Constant::setValue
  */
 public function testSetValue()
 {
     $expected = 'abc';
     $directive = new Constant();
     $result = $directive->setValue($expected);
     $this->assertPropertyEquals($expected, $directive, 'value');
     $this->assertEquals($directive, $result);
 }
Пример #3
0
 /**
  * Data provider for the addDirective test.
  * @return array The data.
  */
 public function providerAddDirective()
 {
     $directive1 = new Setting();
     $directive1->setValue('def')->setName('abc');
     $directive2 = new Constant();
     $directive2->setValue('ghi')->setName('def');
     $directive3 = new Library();
     $directive3->setLibrary('jkl')->setName('abc');
     return array(array(array($directive1->getName() => $directive1), $directive1, array()), array(array($directive1->getName() => $directive1, $directive2->getName() => $directive2), $directive2, array($directive1->getName() => $directive1)), array(array($directive3->getName() => $directive3), $directive3, array($directive1->getName() => $directive1)));
 }