assertEmpty($object->getUrl()); $this->assertEmpty($object->getTooltip()); $object = new Hyperlink('http://test.com'); $this->assertEquals('http://test.com', $object->getUrl()); $this->assertEmpty($object->getTooltip()); $object = new Hyperlink('http://test.com', 'Test'); $this->assertEquals('http://test.com', $object->getUrl()); $this->assertEquals('Test', $object->getTooltip()); } /** * Test get hash code */ public function testGetHashCode() { $object = new Hyperlink(); $this->assertEquals(md5(get_class($object)), $object->getHashCode()); $object = new Hyperlink('http://test.com'); $this->assertEquals(md5('http://test.com'.get_class($object)), $object->getHashCode()); $object = new Hyperlink('http://test.com', 'Test'); $this->assertEquals(md5('http://test.com'.'Test'.get_class($object)), $object->getHashCode()); } /** * Test get/set hash index */ public function testSetGetHashIndex() { $object = new Hyperlink(); $value = rand(1, 100); $object->setHashIndex($value); $this->assertEquals($value, $object->getHashIndex()); } public function testGetSetSlideNumber() { $object = new Hyperlink(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); $this->assertEquals(1, $object->getSlideNumber()); $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); $value = rand(1, 100); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber($value)); $this->assertEquals($value, $object->getSlideNumber()); $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); } public function testGetSetTooltip() { $object = new Hyperlink(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip()); $this->assertEmpty($object->getTooltip()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip('TEST')); $this->assertEquals('TEST', $object->getTooltip()); } public function testGetSetUrl() { $object = new Hyperlink(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl()); $this->assertEmpty($object->getUrl()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); $this->assertEquals('http://www.github.com', $object->getUrl()); } public function testIsInternal() { $object = new Hyperlink(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); $this->assertTrue($object->isInternal()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); $this->assertFalse($object->isInternal()); } }