Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
09086c9
Create UserCreateTest.php
mtmsuhail Apr 9, 2020
a78222c
馃弳 test: should_not_create_user_without_wallet
mtmsuhail Apr 9, 2020
ae4c459
馃弳 test: should_create_user_only_with_wallet
mtmsuhail Apr 9, 2020
37a9620
馃弳 test: should_not_create_user_with_invalid_wallet
mtmsuhail Apr 9, 2020
9a87b99
馃弳 test: should_not_create_user_with_same_wallet
mtmsuhail Apr 9, 2020
be0fe87
馃弳 test: should_create_user_with_valid_data
mtmsuhail Apr 9, 2020
41b1892
馃弳 test: should_not_create_user_with_invalid_data
mtmsuhail Apr 9, 2020
8d828f1
馃弳 test: should_not_create_user_without_unique_name
mtmsuhail Apr 9, 2020
87c17f3
formating
mtmsuhail Apr 9, 2020
2608038
馃弳 test: should_not_create_user_without_accepting_disclaimer_and_terms
mtmsuhail Apr 9, 2020
d61dde3
Create UserUpdateTest.php
mtmsuhail Apr 9, 2020
7e07bfd
馃弳 test: should_not_update_user_without_wallet
mtmsuhail Apr 9, 2020
45fef08
馃弳 test: should_update_user_name_using_wallet
mtmsuhail Apr 9, 2020
320bfd3
馃弳 test: should_not_update_user_with_invalid_wallet
mtmsuhail Apr 9, 2020
dd51fb7
馃弳 test: should_not_update_user_with_non_existing_wallet
mtmsuhail Apr 9, 2020
bdb89ce
馃弳 test: should_update_user_with_valid_data
mtmsuhail Apr 9, 2020
93252c1
馃弳 test: should_not_update_user_with_invalid_data
mtmsuhail Apr 9, 2020
98e6a2d
馃弳 test: should_not_update_user_without_unique_name
mtmsuhail Apr 9, 2020
e20e165
validate error details
mtmsuhail Apr 9, 2020
59c0408
validate error details
mtmsuhail Apr 9, 2020
dc8a01c
Create UserDeleteTest.php
mtmsuhail Apr 9, 2020
33056be
馃弳 test: should_not_delete_user_without_wallet
mtmsuhail Apr 9, 2020
385157e
馃弳 test: should_delete_user_name_using_wallet
mtmsuhail Apr 9, 2020
0731e18
馃弳 test: should_not_delete_user_with_invalid_wallet
mtmsuhail Apr 9, 2020
4558d46
馃弳 test: should_not_delete_user_with_non_existing_wallet
mtmsuhail Apr 9, 2020
3aa5a1f
馃弳 test: should_delete_user_with_data
mtmsuhail Apr 9, 2020
ef6874a
馃弳 test: should_not_delete_user_using_name
mtmsuhail Apr 9, 2020
74ea97c
馃弳 test: should_delete_user_and_create_with_same_name
mtmsuhail Apr 9, 2020
2a660e7
Validate stucture & data
mtmsuhail Apr 9, 2020
eea821b
Validate stucture & data
mtmsuhail Apr 9, 2020
db93889
Validate stucture & data
mtmsuhail Apr 9, 2020
5c46b79
disclaimer & terms should be accepted
mtmsuhail Apr 9, 2020
bb8cb27
Create UserReadTest.php
mtmsuhail Apr 9, 2020
302d6c2
馃弳 test: should_not_read_user_without_wallet
mtmsuhail Apr 9, 2020
2b5f890
should_not_read_user_with_invalid_wallet
mtmsuhail Apr 9, 2020
6dfe675
馃弳 test: should_not_read_user_with_non_existing_wallet
mtmsuhail Apr 9, 2020
ba3f4c0
馃弳 test: should_read_user_with_all_data
mtmsuhail Apr 9, 2020
bd6a078
馃弳 test: should_not_read_user_registration_status_without_wallet
mtmsuhail Apr 9, 2020
5ec56fc
馃弳 test: should_read_user_registration_status_with_wallet
mtmsuhail Apr 9, 2020
281fbb1
Create ContactCreateTest.php
mtmsuhail Apr 20, 2020
680d970
馃弳 test: should_not_create_contract_without_registred_user
mtmsuhail Apr 20, 2020
87cab87
馃弳 test: should_not_create_contract_without_wallet
mtmsuhail Apr 20, 2020
011f98d
馃弳 test: should_not_create_contract_without_part_a_and_b_wallets
mtmsuhail Apr 20, 2020
a7e0f42
馃弳 test: should_create_contract_only_with_party_a_and_b_wallets
mtmsuhail Apr 20, 2020
9fe5133
馃弳 test: should_not_create_contract_with_invalid_wallet
mtmsuhail Apr 20, 2020
2409042
馃弳 test: should_create_contract_with_valid_data
mtmsuhail Apr 20, 2020
059bc4c
馃弳 test: should_not_create_contract_with_invalid_data
mtmsuhail Apr 20, 2020
f6c40f5
Create AttachmentCreateTest.php
mtmsuhail Apr 21, 2020
bb9d61e
馃弳 test: should_upload_a_file_with_an_existing_contract
mtmsuhail Apr 21, 2020
3c315d2
馃弳 test: should_upload_a_file_with_an_existing_dispute_of_a_contract
mtmsuhail Apr 21, 2020
13e92e9
馃弳 test: should_upload_a_file_with_activity_of_a_contract
mtmsuhail Apr 21, 2020
03f4600
Create ContractDeleteTest.php
mtmsuhail Apr 21, 2020
668ad99
馃弳 test: should_not_delete_contract_without_wallet
mtmsuhail Apr 21, 2020
1f24d13
馃弳 test: should_delete_contract_using_wallet_and_contract_id
mtmsuhail Apr 21, 2020
2fb40c9
馃弳 test: should_not_delete_contract_with_invalid_wallet
mtmsuhail Apr 21, 2020
9818c04
馃弳 test: should_not_delete_contract_with_non_existing_wallet
mtmsuhail Apr 21, 2020
a88ef44
馃弳 test: should_not_delete_contract_with_non_existing_id
mtmsuhail Apr 21, 2020
9fad613
馃弳 test: should_delete_all_contracts_related_to_wallet
mtmsuhail Apr 21, 2020
2856d08
Create ContractReadAllTest.php
mtmsuhail Apr 21, 2020
66b572f
馃弳 test: should_not_read_contract_without_wallet
mtmsuhail Apr 21, 2020
e1b7905
馃弳 test: should_not_read_contract_with_invalid_wallet
mtmsuhail Apr 21, 2020
8efdf42
馃弳 test: should_not_read_contract_with_non_existing_wallet
mtmsuhail Apr 21, 2020
43e4ef3
馃弳 test: should_read_contract_with_blank_data
mtmsuhail Apr 21, 2020
06b3e78
馃弳 test: should_read_contract_with_data
mtmsuhail Apr 21, 2020
bd21d1f
馃弳 test: should_read_contract_with_filter_by_dates
mtmsuhail Apr 21, 2020
ad3670f
Create ContractReadTest.php
mtmsuhail Apr 21, 2020
ae4cc42
馃弳 test: should_not_read_single_contract_without_wallet
mtmsuhail Apr 21, 2020
e56cff7
馃弳 test: should_not_read_single_contract_with_invalid_wallet
mtmsuhail Apr 21, 2020
d252445
馃弳 test: should_not_read_single_contract_with_non_existing_wallet
mtmsuhail Apr 21, 2020
1e6eeec
馃弳 test: should_read_single_contract_with_data
mtmsuhail Apr 21, 2020
5ae0be0
Create ContractUpdateTest.php
mtmsuhail Apr 21, 2020
22b19ab
馃弳 test: should_not_update_contract_without_wallet
mtmsuhail Apr 21, 2020
72818b2
馃弳 test: should_not_update_contract_with_invalid_id
mtmsuhail Apr 21, 2020
da34c90
馃弳 test: should_not_update_contract_with_invalid_wallet
mtmsuhail Apr 21, 2020
cbcd6e8
馃弳 test: should_update_contract_with_valid_data
mtmsuhail Apr 21, 2020
6e09fab
馃弳 test: should_not_update_contract_with_invalid_data
mtmsuhail Apr 21, 2020
326cb61
Create DisputeCreateTest.php
mtmsuhail Apr 21, 2020
77950b3
馃弳 test: should_not_create_dispute_without_wallet_and_code
mtmsuhail Apr 21, 2020
7932dae
馃弳 test: should_create_dipute_only_with_code_and_wallet
mtmsuhail Apr 21, 2020
e4e0274
Create DisputeReadAllTest.php
mtmsuhail Apr 21, 2020
4e0d3e1
馃弳 test: should_not_read_dispute_without_wallet
mtmsuhail Apr 21, 2020
828e2c0
馃弳 test: should_not_read_dispute_with_invalid_wallet
mtmsuhail Apr 21, 2020
8013896
馃弳 test: should_not_read_dispute_with_non_existing_wallet
mtmsuhail Apr 21, 2020
ed7cb9a
馃弳 test: should_read_dispute_with_wallet
mtmsuhail Apr 21, 2020
e49232a
馃弳 test: should_read_dispute_with_filter_by_dates
mtmsuhail Apr 21, 2020
d13d90a
Create DisputeReadTest.php
mtmsuhail Apr 21, 2020
78f2f04
馃弳 test: should_not_read_single_dispute_without_wallet
mtmsuhail Apr 21, 2020
8b68bb3
馃弳 test: should_not_read_single_dispute_with_invalid_wallet
mtmsuhail Apr 21, 2020
500aa18
馃弳 test: should_not_read_single_dispute_with_non_existing_wallet
mtmsuhail Apr 21, 2020
1b6b098
馃弳 test: should_read_single_dispute_with_wallet
mtmsuhail Apr 21, 2020
ab01252
Update UserDeleteTest.php
mtmsuhail Apr 21, 2020
a8943ca
Create VoteReadAllTest.php
mtmsuhail Apr 21, 2020
a67ad70
馃弳 test: should_not_read_vote_without_wallet
mtmsuhail Apr 21, 2020
799b150
馃弳 test: should_not_read_vote_with_invalid_wallet
mtmsuhail Apr 21, 2020
d6bb09e
馃弳 test: should_not_read_vote_with_non_existing_wallet
mtmsuhail Apr 21, 2020
7359026
馃弳 test: should_read_vote_without_data
mtmsuhail Apr 21, 2020
8953f41
馃弳 test: should_read_vote_with_data
mtmsuhail Apr 21, 2020
777db3f
Create VoteCreateTest.php
mtmsuhail Apr 21, 2020
b8ec750
馃弳 test: should_not_create_vote_without_wallet
mtmsuhail Apr 21, 2020
8d58fad
馃弳 test: should_not_create_vote_only_with_wallets
mtmsuhail Apr 21, 2020
90dbe85
馃弳 test: should_create_contract_with_valid_data
mtmsuhail Apr 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions rest/tests/Attachment/AttachmentCreateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<?php

use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Laravel\Lumen\Testing\DatabaseTransactions;

class AttachmentCreateTest extends TestCase
{
use DatabaseTransactions;

/**
* @test
*
* @return void
*/
public function should_upload_a_file_with_an_existing_contract()
{
$wallet = '0xdab6AbeF495D2eeE6E4C40174c3b52D3Bc9616A7';

// create user
$user = factory(App\Models\User::class)->create([
'wallet' => $wallet,
]);

// generate fake image
Storage::fake('attachments');

$attachments[] = UploadedFile::fake()->image('attachment.jpg');

// create a contract
$contract = factory(App\Models\Contract::class)->create([
'user_id' => $user->id,
]);

// get encoded id
$id = encodeId($contract->id);

// update contract with attachment
$response = $this->put("api/v1/contracts/{$id}", [
'attachments' => $attachments,
'kpi' => 'test',
], [
'wallet' => $wallet,
]);

// validate status
$this->seeStatusCode(200);

// check attachment available in database
$this->seeInDatabase('media', [
'model_type' => \App\Models\Contract::class,
]);
}

/**
* @test
*
* @return void
*/
public function should_upload_a_file_with_an_existing_dispute_of_a_contract()
{
$wallet = '0xdab6AbeF495D2eeE6E4C40174c3b52D3Bc9616A7';

// create user
$user = factory(App\Models\User::class)->create([
'wallet' => $wallet,
]);

// create fake image
Storage::fake('attachments');

$attachments[] = UploadedFile::fake()->image('attachment.jpg');

// create a contract
$contract = factory(App\Models\Contract::class)->create([
'user_id' => $user->id,
]);

// get encoded id
$id = encodeId($contract->id);

// create a dispute
$dispute = $this->post("api/v1/contracts/disputes/{$id}", [
'attachments' => $attachments,
'code' => 35,
], [
'wallet' => $wallet,
]);

// validate status
$this->seeStatusCode(200);

// check attachment available in database
$this->seeInDatabase('media', [
'model_type' => \App\Models\ContractStatusDetail::class,
]);
}

/**
* @test
*
* @return void
*/
public function should_upload_a_file_with_activity_of_a_contract()
{
$wallet = '0xdab6AbeF495D2eeE6E4C40174c3b52D3Bc9616A6';

// create user
$user = factory(App\Models\User::class)->create([
'wallet' => $wallet,
]);

// create fake image
Storage::fake('attachments');

$attachments[] = UploadedFile::fake()->image('attachment.jpg');

// create a contract
$contract = factory(App\Models\Contract::class)->create([
'user_id' => $user->id,
]);

// get encoded id
$id = encodeId($contract->id);

// create an activity with attachment
$dispute = $this->post("api/v1/activities/{$id}", [
'attachments' => $attachments,
'code' => 35,
], [
'wallet' => $wallet,
]);

// validate status
$this->seeStatusCode(200);

// check attachment available in database
$this->seeInDatabase('media', [
'model_type' => \App\Models\Activity::class,
]);
}
}
Loading