public function testShouldAddUrlToSitemap() { $generator = new Generator(); $generator->setHostname('http://www.example.com'); $generator->setOutputDir($this->outputDir); $url = new Url('http://www.example.com/'); $mock = $this->getMock('\\Sitemapper\\Sitemap', array('addUrl')); $mock->expects($this->once())->method('addUrl')->with($url); $factory = $this->getMock('\\Sitemapper\\SitemapFactory', array('createSitemap')); $factory->expects($this->once())->method('createSitemap')->will($this->returnValue($mock)); $generator->setSitemapFactory($factory); $generator->addUrl($url); }