/** * Test if variable value equals expected value * * @dataProvider variableProvider */ public function testGetValue($actual, $expected) { $var = new Variable('foo', 'bar', false, false, new Location(1, 1)); $var->setValue($actual); $this->assertEquals($var->getValue(), $expected); }
public function testVariable() { $variable = new Variable('id', 'int', false, false, new Location(1, 1)); $this->assertEquals('id', $variable->getName()); $this->assertEquals('int', $variable->getTypeName()); $this->assertFalse($variable->isNullable()); $this->assertFalse($variable->isArray()); $variable->setTypeName('string'); $this->assertEquals('string', $variable->getTypeName()); $variable->setName('limit'); $this->assertEquals('limit', $variable->getName()); $variable->setIsArray(true); $variable->setNullable(true); $this->assertTrue($variable->isNullable()); $this->assertTrue($variable->isArray()); $variable->setValue(new Literal('text', new Location(1, 1))); $this->assertEquals(new Literal('text', new Location(1, 1)), $variable->getValue()); }