mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
commit
75a7378c2d
@ -1 +1 @@
|
||||
5.10.4
|
||||
5.10.5
|
@ -80,8 +80,8 @@ class StoreProjectRequest extends Request
|
||||
$input['budgeted_hours'] = 0;
|
||||
}
|
||||
|
||||
$input['task_rate'] = isset($input['task_rate']) ? $input['task_rate'] : 0;
|
||||
|
||||
$input['task_rate'] = (isset($input['task_rate']) && floatval($input['task_rate']) >= 0) ? $input['task_rate'] : 0;
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,8 @@ class UpdateProjectRequest extends Request
|
||||
$rules['number'] = Rule::unique('projects')->where('company_id', $user->company()->id)->ignore($this->project->id);
|
||||
}
|
||||
|
||||
$rules['budgeted_hours'] = 'sometimes|numeric';
|
||||
$rules['budgeted_hours'] = 'sometimes|bail|numeric';
|
||||
$rules['task_rate'] = 'sometimes|bail|numeric';
|
||||
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->fileValidation();
|
||||
|
@ -17,8 +17,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => env('APP_VERSION', '5.10.4'),
|
||||
'app_tag' => env('APP_TAG', '5.10.4'),
|
||||
'app_version' => env('APP_VERSION', '5.10.5'),
|
||||
'app_tag' => env('APP_TAG', '5.10.5'),
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
@ -47,6 +47,117 @@ class ProjectApiTest extends TestCase
|
||||
Model::reguard();
|
||||
}
|
||||
|
||||
public function testCreateProjectWithNullTaskRate()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'name' => 'howdy',
|
||||
'task_rate' => null,
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/projects", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(0, $arr['data']['task_rate']);
|
||||
|
||||
}
|
||||
|
||||
public function testCreateProjectWithNullTaskRate2()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'name' => 'howdy',
|
||||
'task_rate' => "A",
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/projects", $data);
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testCreateProjectWithNullTaskRate3()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'name' => 'howdy',
|
||||
'task_rate' => "10",
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/projects", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(10, $arr['data']['task_rate']);
|
||||
|
||||
}
|
||||
|
||||
public function testCreateProjectWithNullTaskRate5()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'name' => 'howdy',
|
||||
'task_rate' => "-10",
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/projects", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(0, $arr['data']['task_rate']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testCreateProjectWithNullTaskRate4()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'name' => 'howdy',
|
||||
'task_rate' => 10,
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/projects", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(10, $arr['data']['task_rate']);
|
||||
|
||||
}
|
||||
|
||||
public function testProjectIncludesZeroCount()
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user