Closed menkaff closed 4 years ago
Here is my TestClass
<?php
namespace Modules\Easyshop\Tests;
use Laravel\Passport\Passport;
use Modules\Easyshop\Models\Buyer;
use Modules\Easyshop\Models\Good;
use Tests\TestCase;
class BuyerGoodTest extends TestCase
{
/**
* A basic unit test example.
*
* @return void
*/
public function testIndex()
{
Passport::actingAs(
factory(Buyer::class)->make(),
[], //scopes
'api_buyer'
);
$response = $this->json('GET', '/api/easyshop/v1/buyer/good', ['seller_id' => 5]);
$response->assertStatus(200);
$response->assertJson([
'is_successful' => true,
]);
$response->assertJsonStructure(
[
'is_successful',
'data' => [
'*' => [
"id",
"seller_id",
"good_cat_id",
"title",
"content",
"featured_image",
"type",
"main_price",
"real_price",
"discount",
"is_special",
"is_exist",
"created_at",
"updated_at",
"deleted_at",
"is_liked",
],
],
]
);
}
public function testShow()
{
Passport::actingAs(
factory(Buyer::class)->create(),
[], //scopes
'api_buyer'
);
$good = Good::first();
$response = $this->json('GET', '/api/easyshop/v1/buyer/good/show', ['good_id' => $good->id]);
$response->assertStatus(200);
$response->assertJson([
'is_successful' => true,
]);
$response->assertJsonStructure(
[
'is_successful',
'data' => [
"id",
"title",
"content",
"featured_image",
"type",
"main_price",
"real_price",
"discount",
"good_cat_id",
"seller_id",
"is_liked",
"seller" => [
"id",
"shop_name",
],
],
]
);
}
}
I have the same issue right now. Looks like you've merged the menkaff's PR but you haven't released it so when I do composer require ybazli/faker
I get the old ( broken ) code.
Hi @xperator are you using dev master version?
@menkaff Um... I just follow the instruction written on the main page. ( I run composer require ybazli/faker
)
Am I supposed to do something else to get the latest code?
Check composer.json that using dev-master , like this
"ybazli/faker": "dev-master"
@menkaff Thanks a lot! It's working now.
when using this faker in tests if i have more than one function in a classTest this error thrown