Exemplo n.º 1
0
 public function testOoParams()
 {
     $t = new \Test\Oo\OoParams();
     $this->assertInstanceOf('Test\\Oo\\OoParams', $t->createThisClassWithoutWriteCurrentNamespace());
     $this->assertinstanceOf('Test\\Oo\\OoDynamicA', $t->createOtherClassWithoutWriteCurrentNamespace());
     $this->assertSame($t->setAge(17), 17);
     $this->assertSame($t->setAge('17'), 17);
     $this->assertSame($t->setAge(17.0), 17);
     $this->assertSame($t->setAverage(17.1), 17.1);
     $this->assertSame($t->setAverage(17), 17.0);
     $this->assertSame($t->setAverage('17.5'), 17.5);
     $this->assertSame($t->setName('peter'), 'peter');
     $this->assertSame($t->setName(12.5), '12.5');
     $this->assertSame($t->setName(17), '17');
     $this->assertSame($t->setEnabled(true), true);
     $this->assertSame($t->setEnabled(false), false);
     $this->assertSame($t->setEnabled(1), true);
     $this->assertSame($t->setEnabled(0), false);
     $this->assertSame($t->setEnabled('1'), true);
     $this->assertSame($t->setEnabled('0'), false);
     $this->assertSame($t->setList(array(1, 2, 3, 4, 5)), array(1, 2, 3, 4, 5));
     $this->assertSame($t->setList(array()), array());
 }
Exemplo n.º 2
0
 public function testOoParams()
 {
     $t = new \Test\Oo\OoParams();
     $this->assertTrue($t->createThisClassWithoutWriteCurrentNamespace() instanceof \Test\Oo\OoParams);
     $this->assertTrue($t->createOtherClassWithoutWriteCurrentNamespace() instanceof \Test\Oo\OoDynamicA);
     $this->assertTrue($t->setAge(17) === 17);
     $this->assertTrue($t->setAge("17") === 17);
     $this->assertTrue($t->setAge(17.0) === 17);
     $this->assertTrue($t->setAverage(17.1) === 17.1);
     $this->assertTrue($t->setAverage(17) === 17.0);
     $this->assertTrue($t->setAverage("17.5") === 17.5);
     $this->assertTrue($t->setName("peter") === "peter");
     $this->assertTrue($t->setName(12.5) === "12.5");
     $this->assertTrue($t->setName(17) === "17");
     $this->assertTrue($t->setEnabled(true) === true);
     $this->assertTrue($t->setEnabled(false) === false);
     $this->assertTrue($t->setEnabled(1) === true);
     $this->assertTrue($t->setEnabled(0) === false);
     $this->assertTrue($t->setEnabled("1") === true);
     $this->assertTrue($t->setEnabled("0") === false);
     $this->assertTrue($t->setList(array(1, 2, 3, 4, 5)) === array(1, 2, 3, 4, 5));
     $this->assertTrue($t->setList(array()) == array());
 }