Skip to content

Commit

Permalink
chore: 修复所有测试保证通过
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Nov 30, 2018
1 parent 65460cd commit 55713ed
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 30 deletions.
32 changes: 16 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ php:
# - 7.3
- nightly # 每夜 PHP 构建,PHP 开发版本
env:
# - DB=mysql
- DB=mysql
- DB=postgres
services:
- mysql
Expand All @@ -33,18 +33,18 @@ script: php vendor/bin/phpunit --coverage-clover=coverage.xml
after_script:
- php vendor/bin/codacycoverage clover coverage.xml
- bash <(curl -s https://codecov.io/bash)
# jobs:
# include:
# - stage: Build
# name: Build Assets Test
# language: node_js
# node_js: 6
# cache:
# directories:
# - "node_modules"
# services: null
# env: null
# before_install: null
# install: npm install
# script: npm run dev
# after_script: null
jobs:
include:
- stage: Build
name: Build Assets Test
language: node_js
node_js: 6
cache:
directories:
- "node_modules"
services: null
env: null
before_install: null
install: npm install
script: npm run dev
after_script: null
16 changes: 7 additions & 9 deletions app/Http/Controllers/APIs/V2/LocationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ public function search(Request $request, ResponseFactoryContract $response, Area
return $tree;
};

return $model->getConnection()->transaction(function () use ($areas, $parentTreeCall, $response) {
return $response->json($areas->map(function (AreaModel $item) use ($parentTreeCall) {
$item->setHidden(array_merge($item->getHidden(), ['items']));
return $response->json($areas->map(function (AreaModel $item) use ($parentTreeCall) {
$item->setHidden(array_merge($item->getHidden(), ['items']));

return [
'items' => count($parentTreeCall($parentTreeCall, $item, [$item])) < 3 ? $item->items : null,
'tree' => $item,
];
}))->setStatusCode(200);
});
return [
'items' => count($parentTreeCall($parentTreeCall, $item, [$item])) < 3 ? $item->items : null,
'tree' => $item,
];
}))->setStatusCode(200);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function up()
$table->integer('file_id')->unsigned()->comment('文件ID');
$table->integer('user_id')->unsigned()->comment('用户ID');
$table->string('channel', 100)->nullable()->default(null)->comment('记录频道');
$table->string('raw', 100)->nullable()->default(null)->comment('原始频道关联信息');
$table->integer('raw')->nullable()->comment('原始频道关联信息');
$table->string('size', 50)->nullable()->default(null)->comment('图片尺寸,目标文件如果是图片的话则存在。便于客户端提前预设盒子');
$table->timestamps();
$table->softDeletes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function up()
Schema::create('paid_nodes', function (Blueprint $table) {
$table->increments('id')->comment('付费记录ID');
$table->string('channel', 100)->comment('付费频道');
$table->string('raw', 150)->comment('付费原始信息');
$table->integer('raw')->comment('付费原始信息');
$table->string('subject')->comment('付费主题');
$table->string('body')->comment('付费内容详情');
$table->bigInteger('amount')->unsigned()->comment('付费金额');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public function testDeleteFeedComment()

$response = $this
->json('DELETE', "/api/v2/feeds/{$feed}/comments/{$comm}");
$response->dump();
$response
->assertStatus(204);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/API2/LocationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LocationsTest extends TestCase
*/
public function testSearchLocations()
{
$response = $this->get('/api/v2/locations/search?name=北京');
$response = $this->json('GET', '/api/v2/locations/search?name='.urlencode('北京'));

$response->assertStatus(200);
}
Expand All @@ -43,7 +43,7 @@ public function testSearchLocations()
*/
public function testGetHotLocations()
{
$response = $this->get('/api/v2/locations/hots');
$response = $this->json('GET', '/api/v2/locations/hots');

$response->assertStatus(200);
}
Expand Down

0 comments on commit 55713ed

Please sign in to comment.