test: refactor tests (#6217)

Co-authored-by: Alexis Saettler <alexis@saettler.org>
This commit is contained in:
mehdihasanpour
2022-10-16 23:47:10 +03:30
committed by GitHub
parent 85a2f2f984
commit bf1e3fe3d0
10 changed files with 28 additions and 40 deletions
+1
View File
@@ -156,6 +156,7 @@ class SpecialDate extends Model
// the years
if ($year != 0) {
$date = Carbon::createFromDate($year, $month, $day);
$this->is_year_unknown = false;
} else {
$date = Carbon::createFromDate(now()->year, $month, $day);
$this->is_year_unknown = true;
+2 -4
View File
@@ -33,8 +33,7 @@ class ApiControllerTest extends ApiTestCase
{
$apiController = new ApiController;
$this->assertEquals(
null,
$this->assertNull(
$apiController->getErrorCode()
);
@@ -51,8 +50,7 @@ class ApiControllerTest extends ApiTestCase
{
$apiController = new ApiController;
$this->assertEquals(
null,
$this->assertNull(
$apiController->getWithParameter()
);
+5 -10
View File
@@ -266,8 +266,7 @@ class AccountTest extends FeatureTestCase
'has_access_to_paid_version_for_free' => true,
]);
$this->assertEquals(
true,
$this->assertTrue(
$account->isSubscribed()
);
}
@@ -279,8 +278,7 @@ class AccountTest extends FeatureTestCase
'has_access_to_paid_version_for_free' => false,
]);
$this->assertEquals(
false,
$this->assertFalse(
$account->isSubscribed()
);
}
@@ -299,8 +297,7 @@ class AccountTest extends FeatureTestCase
config(['monica.paid_plan_monthly_friendly_name' => 'fakePlan']);
$this->assertEquals(
true,
$this->assertTrue(
$account->isSubscribed()
);
}
@@ -319,8 +316,7 @@ class AccountTest extends FeatureTestCase
config(['monica.paid_plan_annual_friendly_name' => 'annualPlan']);
$this->assertEquals(
true,
$this->assertTrue(
$account->isSubscribed()
);
}
@@ -330,8 +326,7 @@ class AccountTest extends FeatureTestCase
{
$account = factory(Account::class)->create();
$this->assertEquals(
false,
$this->assertFalse(
$account->isSubscribed()
);
}
+1 -2
View File
@@ -496,8 +496,7 @@ class ContactTest extends FeatureTestCase
$contact->account_id = 1;
$contact->id = 1;
$this->assertEquals(
null,
$this->assertNull(
$contact->getLastActivityDate()
);
}
+2 -4
View File
@@ -17,8 +17,7 @@ class GiftTest extends TestCase
{
$gift = factory(Gift::class)->make();
$this->assertEquals(
false,
$this->assertFalse(
$gift->hasParticularRecipient()
);
}
@@ -30,8 +29,7 @@ class GiftTest extends TestCase
'is_for' => 1,
]);
$this->assertEquals(
true,
$this->assertTrue(
$gift->hasParticularRecipient()
);
}
+5 -5
View File
@@ -22,7 +22,7 @@ class Google2FATest extends TestCase
$result = $google2fa->verifyGoogle2FA($secret, 'aaaaaa');
$this->assertEquals(false, $result);
$this->assertFalse($result);
}
/** @test */
@@ -35,7 +35,7 @@ class Google2FATest extends TestCase
$result = $google2fa->verifyGoogle2FA($secret, $one_time_password);
$this->assertEquals(true, $result);
$this->assertTrue($result);
}
/** @test */
@@ -57,12 +57,12 @@ class Google2FATest extends TestCase
$authenticator = new \PragmaRX\Google2FALaravel\Support\Authenticator($request);
$this->assertEquals(false, $authenticator->isAuthenticated());
$this->assertFalse($authenticator->isAuthenticated());
$this->assertEquals(true, $google2fa->isActivated());
$this->assertTrue($google2fa->isActivated());
$google2fa->login();
$this->assertEquals(true, $authenticator->isAuthenticated());
$this->assertTrue($authenticator->isAuthenticated());
}
}
+3 -6
View File
@@ -79,8 +79,7 @@ class SpecialDateTest extends FeatureTestCase
$specialDate->createFromAge(100);
$this->assertEquals(
true,
$this->assertTrue(
$specialDate->is_age_based
);
@@ -102,8 +101,7 @@ class SpecialDateTest extends FeatureTestCase
$specialDate->createFromDate(0, 10, 10);
$this->assertEquals(
true,
$this->assertTrue(
$specialDate->is_year_unknown
);
@@ -130,8 +128,7 @@ class SpecialDateTest extends FeatureTestCase
$specialDate->createFromDate(2019, 10, 10);
$this->assertEquals(
false,
$this->assertFalse(
$specialDate->is_year_unknown
);
@@ -80,8 +80,8 @@ class CreateActivityTest extends TestCase
$emotion2 = factory(Emotion::class)->create([]);
$emotionArray = [];
array_push($emotionArray, $emotion->id);
array_push($emotionArray, $emotion2->id);
$emotionArray[] = $emotion->id;
$emotionArray[] = $emotion2->id;
$activityType = factory(ActivityType::class)->create([
'account_id' => $account->id,
@@ -76,8 +76,8 @@ class CreateCallTest extends TestCase
$emotion2 = factory(Emotion::class)->create([]);
$emotionArray = [];
array_push($emotionArray, $emotion->id);
array_push($emotionArray, $emotion2->id);
$emotionArray[] = $emotion->id;
$emotionArray[] = $emotion2->id;
$request = [
'contact_id' => $contact->id,
@@ -118,7 +118,7 @@ class CreateCallTest extends TestCase
{
$contact = factory(Contact::class)->create([]);
$emotionArray = [];
array_push($emotionArray, 1111111);
$emotionArray[] = 1111111;
$request = [
'contact_id' => $contact->id,
@@ -124,8 +124,8 @@ class UpdateCallTest extends TestCase
]);
$emotionArray = [];
array_push($emotionArray, $emotion->id);
array_push($emotionArray, $emotion2->id);
$emotionArray[] = $emotion->id;
$emotionArray[] = $emotion2->id;
$request = [
'account_id' => $call->account_id,
@@ -184,8 +184,8 @@ class UpdateCallTest extends TestCase
$emotion3 = factory(Emotion::class)->create([]);
$emotion4 = factory(Emotion::class)->create([]);
$emotionArray = [];
array_push($emotionArray, $emotion3->id);
array_push($emotionArray, $emotion4->id);
$emotionArray[] = $emotion3->id;
$emotionArray[] = $emotion4->id;
$request = [
'account_id' => $call->account_id,