/** * Tests site update route method with */ public function testUpdateRoutes() { $site = $this->getMock('Sonata\\PageBundle\\Model\\SiteInterface'); $tmpFile = tmpfile(); $this->routePageGenerator->update($site, new StreamOutput($tmpFile)); fseek($tmpFile, 0); $output = ''; while (!feof($tmpFile)) { $output = fread($tmpFile, 4096); } $this->assertRegExp('/CREATE(.*)route1(.*)\\/first_custom_route/', $output); $this->assertRegExp('/CREATE(.*)route1(.*)\\/first_custom_route/', $output); $this->assertRegExp('/CREATE(.*)404/', $output); $this->assertRegExp('/CREATE(.*)500/', $output); $this->assertRegExp('/ERROR(.*)test_hybrid_page_not_exists/', $output); }
/** * Tests site update route method with */ public function testUpdateRoutes() { $site = $this->getSiteMock(); $tmpFile = tmpfile(); $this->routePageGenerator->update($site, new StreamOutput($tmpFile)); fseek($tmpFile, 0); $output = ''; while (!feof($tmpFile)) { $output = fread($tmpFile, 4096); } $this->assertRegExp('/CREATE(.*)route1(.*)\\/first_custom_route/', $output); $this->assertRegExp('/CREATE(.*)route1(.*)\\/first_custom_route/', $output); $this->assertRegExp('/CREATE(.*)test_hybrid_page_with_good_host(.*)\\/third_custom_route/', $output); $this->assertRegExp('/CREATE(.*)404/', $output); $this->assertRegExp('/CREATE(.*)500/', $output); $this->assertRegExp('/DISABLE(.*)test_hybrid_page_with_bad_host(.*)\\/fourth_custom_route/', $output); $this->assertRegExp('/UPDATE(.*)test_hybrid_page_with_bad_host(.*)\\/fourth_custom_route/', $output); $this->assertRegExp('/ERROR(.*)test_hybrid_page_not_exists/', $output); }
/** * {@inheritdoc} */ public function postPersist($object) { $this->routePageGenerator->update($object); }