* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ require_once 'BaseTest.php'; require_once 'Source/Anivisual.php'; class ItchTest extends BaseTest { protected function setUp() { $this->parser = new Source\Anivisual(); } public function testPageCheck() { $this->assertTrue($this->parser->checkPage('https://anivisual.net/stuff/3-1-0-1889')); $this->assertFalse($this->parser->checkPage('https://anivisual.net/')); $this->assertFalse($this->parser->checkPage('http://anivisual.net')); $this->assertFalse($this->parser->checkPage('http://itch.io')); } public function testPageParsing() { $url = 'https://anivisual.net/stuff/3-1-0-1889'; $game_page = NULL; try { $game_page = $this->parser->get_text($url); } catch (\Exception $e) { $game_page = file_get_contents('./tests/fixtures/anivisual_test_1.html'); } if (is_null($game_page)) { $game_page = file_get_contents('./tests/fixtures/anivisual_test_1.html'); } $this->parser->loadStr($game_page, []); $game = $this->parser->page($url); $this->assertSame($game->url, $url); $this->assertSame($game->title, 'Contract Demon'); $this->assertSame($game->author, 'NomnomNami, пер. Sol Taere'); $this->assertSame($game->description, 'Ангел, вместо своих ангельских дел, вызывает... демона. Да и демонесса какая-то странная, пытается выглядеть зловеще, но что-то совсем не получается. По крайней мере Ангел её не боится ни капли, а вроде даже наоборот... _______ От переводчика. Как я люблю эту короткометражную няшноту от NomnomNami, просто ужос. Хотел было и дальше переводить её поделки, но узнал, что уже всё переведено. А жаль. Работать с такими штуками - одно удовольствие. Лёгкий и приятный текст, и всего один-два дня работы. Прохождение этой ВН от Тернокса и Химари — р-р-раз, д-д-два'); } }