Compare commits
10 Commits
feature/ok
...
feature/mo
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0522270c1c | ||
![]() |
9bd6b23c05 | ||
![]() |
0e3878a808 | ||
![]() |
4c0b245574 | ||
![]() |
0a0047c4c3 | ||
![]() |
831d1668ef | ||
![]() |
51c8199283 | ||
![]() |
78a1bdfb30 | ||
![]() |
ceff57f9f6 | ||
![]() |
58ae1bc1c1 |
@@ -3,7 +3,7 @@ version: 2.1
|
||||
executors:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/php:7.1-node-browsers
|
||||
- image: circleci/php:7.3-node-browsers
|
||||
environment:
|
||||
APP_DEBUG: true
|
||||
APP_ENV: testing
|
||||
|
@@ -1,6 +1,6 @@
|
||||
FROM node:10-jessie as node
|
||||
|
||||
FROM php:7.1-apache
|
||||
FROM php:7.3-apache
|
||||
|
||||
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
|
||||
|
||||
|
@@ -13,7 +13,9 @@
|
||||
"laravel/framework": "5.5.*",
|
||||
"laravel/tinker": "~1.0",
|
||||
"misd/linkify": "^1.1",
|
||||
"staudenmeir/eloquent-eager-limit": "^1.0"
|
||||
"staudenmeir/eloquent-eager-limit": "^1.0",
|
||||
"symfony/css-selector": "^4.3",
|
||||
"symfony/dom-crawler": "^4.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.1",
|
||||
|
84
composer.lock
generated
84
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "665f6f5eb180a1295fb60303d2ea5051",
|
||||
"content-hash": "28abd730d4572663d10ae815393c73cd",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anhskohbo/no-captcha",
|
||||
@@ -2113,16 +2113,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v4.2.1",
|
||||
"version": "v4.3.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd"
|
||||
"reference": "105c98bb0c5d8635bea056135304bd8edcc42b4d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/aa9fa526ba1b2ec087ffdfb32753803d999fcfcd",
|
||||
"reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/105c98bb0c5d8635bea056135304bd8edcc42b4d",
|
||||
"reference": "105c98bb0c5d8635bea056135304bd8edcc42b4d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2131,7 +2131,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -2147,14 +2147,14 @@
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jean-François Simon",
|
||||
"email": "jeanfrancois.simon@sensiolabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Jean-François Simon",
|
||||
"email": "jeanfrancois.simon@sensiolabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
@@ -2162,7 +2162,7 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-11-11T19:52:12+00:00"
|
||||
"time": "2019-01-16T21:53:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
@@ -2220,6 +2220,67 @@
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-11-27T12:43:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v4.3.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "291397232a2eefb3347eaab9170409981eaad0e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/291397232a2eefb3347eaab9170409981eaad0e2",
|
||||
"reference": "291397232a2eefb3347eaab9170409981eaad0e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"symfony/polyfill-ctype": "~1.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"masterminds/html5": "<2.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"masterminds/html5": "^2.6",
|
||||
"symfony/css-selector": "~3.4|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/css-selector": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\DomCrawler\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-06-13T11:03:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v4.2.1",
|
||||
@@ -4888,6 +4949,7 @@
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2018-08-09T05:50:03+00:00"
|
||||
},
|
||||
{
|
||||
|
@@ -22,12 +22,12 @@ trait CreateMockedResolver
|
||||
|
||||
/**
|
||||
* @param string $resolverClass
|
||||
* @param string $responseText
|
||||
* @param string|array $response
|
||||
* @param array $headers
|
||||
* @param int $status
|
||||
* @return Resolver
|
||||
*/
|
||||
protected function createResolver(string $resolverClass, string $responseText, array $headers = [], int $status = 200)
|
||||
protected function createResolver(string $resolverClass, $response, array $headers = [], int $status = 200)
|
||||
{
|
||||
if (!$this->shouldUseMock()) {
|
||||
$this->resolver = app()->make($resolverClass);
|
||||
@@ -39,8 +39,26 @@ trait CreateMockedResolver
|
||||
'content-type' => 'text/html',
|
||||
];
|
||||
|
||||
$mockResponse = new Response($status, $headers, $responseText);
|
||||
if (is_array($response)) {
|
||||
$responses = $response;
|
||||
$mockResponses = [];
|
||||
foreach ($responses as $response) {
|
||||
if (is_array($response)) {
|
||||
$response += [
|
||||
1 => $headers,
|
||||
2 => $status
|
||||
];
|
||||
array_push($mockResponses, new Response($response[2], $response[1], $response[0]));
|
||||
} else {
|
||||
array_push($mockResponses, new Response($status, $headers, $response));
|
||||
}
|
||||
}
|
||||
$this->handler = new MockHandler($mockResponses);
|
||||
} else {
|
||||
$mockResponse = new Response($status, $headers, $response);
|
||||
$this->handler = new MockHandler([$mockResponse]);
|
||||
}
|
||||
|
||||
$client = new Client(['handler' => $this->handler]);
|
||||
$this->resolver = app()->make($resolverClass, ['client' => $client]);
|
||||
|
||||
|
@@ -40,13 +40,13 @@ class PixivResolverTest extends TestCase
|
||||
|
||||
$this->createResolver(PixivResolver::class, $responseText);
|
||||
|
||||
$metadata = $this->resolver->resolve('https://www.pixiv.net/member_illust.php?mode=medium&illust_id=74939802');
|
||||
$this->assertEquals('T-20S', $metadata->title);
|
||||
$this->assertEquals('投稿者: amssc' . PHP_EOL . 'JUST FOR FUN' . PHP_EOL . '现在可以做到游戏内立绘修改拉!立绘动态皮肤都可以支持,想要资助获得新技术请站内信联系我。', $metadata->description);
|
||||
$this->assertEquals('https://i.pixiv.cat/img-master/img/2019/05/28/01/16/24/74939802_p0_master1200.jpg', $metadata->image);
|
||||
$this->assertEquals(['巨乳', '母乳', 'lastorigin', 'Last_Origin', 'T-20S', 'おっぱい', '라스트오리진', '노움'], $metadata->tags);
|
||||
$metadata = $this->resolver->resolve('https://www.pixiv.net/member_illust.php?mode=medium&illust_id=75899985');
|
||||
$this->assertEquals('コミッション絵33', $metadata->title);
|
||||
$this->assertEquals('投稿者: ナゼ(NAZE)' . PHP_EOL . 'Leak' . PHP_EOL . PHP_EOL . 'Character:アリッサさん(依頼主のオリキャラ)', $metadata->description);
|
||||
$this->assertEquals('https://i.pixiv.cat/img-master/img/2019/07/25/13/02/59/75899985_p0_master1200.jpg', $metadata->image);
|
||||
$this->assertEquals(['巨乳輪', '超乳', '巨乳首', '母乳'], $metadata->tags);
|
||||
if ($this->shouldUseMock()) {
|
||||
$this->assertSame('https://www.pixiv.net/ajax/illust/74939802', (string) $this->handler->getLastRequest()->getUri());
|
||||
$this->assertSame('https://www.pixiv.net/ajax/illust/75899985', (string) $this->handler->getLastRequest()->getUri());
|
||||
}
|
||||
}
|
||||
|
||||
|
228
tests/fixture/Pixiv/illustMultiPages.json
vendored
228
tests/fixture/Pixiv/illustMultiPages.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user