Example #1
0
 public function testDownloadRevision()
 {
     $this->assertTrue(downloader()->isDownloaded('/laws/card/254к/96-вр'));
     $this->assertTrue(downloader()->isDownloaded('/laws/show/254к/96-вр/ed20140515/page'));
     $this->assertTrue(downloader()->isDownloaded('/laws/show/254к/96-вр/ed20140515/page2'));
     $this->assertTrue(downloader()->isDownloaded('/laws/show/254к/96-вр/ed20140515/page3'));
     $this->assertTrue(downloader()->isDownloaded('/laws/show/254к/96-вр/ed20140515/page4'));
     Law::firstOrCreate(['id' => '254к/96-вр']);
     $law = $this->obj->downloadCard('254к/96-вр');
     $revision = $this->obj->downloadRevision('254к/96-вр', '2014-05-15');
     $text = file_get_contents(base_path() . '/tests/fixtures/partials/254к/96-вр/text.txt');
     $this->assertEquals($revision->text, $text);
     $this->assertEquals($law->active_revision()->first()->text, $text);
     $this->assertEquals($revision->status, Revision::UP_TO_DATE);
     $this->assertTrue(downloader()->isDownloaded('/laws/card/2952-17'));
     $this->assertTrue(downloader()->isDownloaded('/laws/show/2952-17/ed20110201/page'));
     Law::firstOrCreate(['id' => '2952-17']);
     $law = $this->obj->downloadCard('2952-17');
     $revision = $this->obj->downloadRevision('2952-17', '2011-02-01');
     $text = file_get_contents(base_path() . '/tests/fixtures/partials/2952-17/text.txt');
     $this->assertEquals($revision->text, $text);
     $this->assertEquals($law->active_revision()->first()->text, $text);
     $this->assertEquals($revision->status, Revision::UP_TO_DATE);
 }
Example #2
0
function fullURL($url)
{
    return downloader()->fullURL($url);
}
Example #3
0
 function is_403($html)
 {
     return downloader()->detectFakeContent($html, '403');
 }