Skip to content
Permalink
Browse files

Call the static test functions statically

  • Loading branch information
carakas committed Jan 30, 2020
1 parent db7b4eb commit f3054c5d4fdac2fa86ad3155db18e47c37839f99
Showing with 435 additions and 435 deletions.
  1. +12 −12 src/Backend/Core/Tests/Engine/PasswordStrengthCheckerTest.php
  2. +58 −58 src/Backend/Modules/Blog/Tests/Engine/ModelTest.php
  3. +16 −16 src/Backend/Modules/Faq/Tests/Engine/ModelTest.php
  4. +3 −3 src/Backend/Modules/MediaLibrary/Tests/Manager/StorageManagerTest.php
  5. +50 −50 src/Backend/Modules/Profiles/Tests/Engine/ModelTest.php
  6. +15 −15 src/Backend/Modules/Tags/Tests/Actions/EditTest.php
  7. +3 −3 src/Backend/Modules/Tags/Tests/Actions/IndexTest.php
  8. +9 −9 src/Backend/Modules/Tags/Tests/Actions/MassActionTest.php
  9. +49 −49 src/Backend/Modules/Tags/Tests/Engine/ModelTest.php
  10. +10 −10 src/Common/Tests/Core/Header/AssetCollectionTest.php
  11. +4 −4 src/Common/Tests/Core/Header/JsDataTest.php
  12. +6 −6 src/Common/Tests/Core/Header/PriorityTest.php
  13. +2 −2 src/ForkCMS/Bundle/CoreBundle/Tests/Validator/UrlValidatorTest.php
  14. +1 −1 src/Frontend/Core/Tests/Header/MetaCollectionTest.php
  15. +16 −16 src/Frontend/Core/Tests/Header/MetaDataTest.php
  16. +22 −22 src/Frontend/Core/Tests/Header/MetaLinkTest.php
  17. +24 −24 src/Frontend/Modules/Profiles/Tests/Engine/AuthenticationTest.php
  18. +66 −66 src/Frontend/Modules/Profiles/Tests/Engine/ModelTest.php
  19. +24 −24 src/Frontend/Modules/Profiles/Tests/Engine/ProfileTest.php
  20. +6 −6 src/Frontend/Modules/Tags/Tests/Actions/DetailTest.php
  21. +4 −4 src/Frontend/Modules/Tags/Tests/Actions/IndexTest.php
  22. +29 −29 src/Frontend/Modules/Tags/Tests/Engine/ModelTest.php
  23. +6 −6 tests/Utility/ThumbnailsTest.php
@@ -9,25 +9,25 @@ class PasswordStrengthCheckerTest extends TestCase
{
public function testWeakPasswords(): void
{
$this->assertEquals('weak', PasswordStrengthChecker::checkPassword('abc'));
$this->assertEquals('weak', PasswordStrengthChecker::checkPassword('azerty'));
$this->assertEquals('weak', PasswordStrengthChecker::checkPassword('12345'));
$this->assertEquals('weak', PasswordStrengthChecker::checkPassword('forkcms'));
self::assertEquals('weak', PasswordStrengthChecker::checkPassword('abc'));
self::assertEquals('weak', PasswordStrengthChecker::checkPassword('azerty'));
self::assertEquals('weak', PasswordStrengthChecker::checkPassword('12345'));
self::assertEquals('weak', PasswordStrengthChecker::checkPassword('forkcms'));
}

public function testAveragePasswords(): void
{
$this->assertEquals('average', PasswordStrengthChecker::checkPassword('forkcms777'));
$this->assertEquals('average', PasswordStrengthChecker::checkPassword('I<3ForkCMS'));
$this->assertEquals('average', PasswordStrengthChecker::checkPassword('ForkR0cks'));
$this->assertEquals('average', PasswordStrengthChecker::checkPassword('CorrectHorseBatteryStaple'));
self::assertEquals('average', PasswordStrengthChecker::checkPassword('forkcms777'));
self::assertEquals('average', PasswordStrengthChecker::checkPassword('I<3ForkCMS'));
self::assertEquals('average', PasswordStrengthChecker::checkPassword('ForkR0cks'));
self::assertEquals('average', PasswordStrengthChecker::checkPassword('CorrectHorseBatteryStaple'));
}

public function testStrongPasswords(): void
{
$this->assertEquals('strong', PasswordStrengthChecker::checkPassword('ThisIsMySuperLongPasswordThatIsSave!'));
$this->assertEquals('strong', PasswordStrengthChecker::checkPassword('CorrectHorseBatteryStap!e'));
$this->assertEquals('strong', PasswordStrengthChecker::checkPassword('1kaoKzkda($%$azdazdamùzd'));
$this->assertEquals('strong', PasswordStrengthChecker::checkPassword('Qàsd)àé"ùéù"dmé"ld'));
self::assertEquals('strong', PasswordStrengthChecker::checkPassword('ThisIsMySuperLongPasswordThatIsSave!'));
self::assertEquals('strong', PasswordStrengthChecker::checkPassword('CorrectHorseBatteryStap!e'));
self::assertEquals('strong', PasswordStrengthChecker::checkPassword('1kaoKzkda($%$azdazdamùzd'));
self::assertEquals('strong', PasswordStrengthChecker::checkPassword('Qàsd)àé"ùéù"dmé"ld'));
}
}
@@ -38,17 +38,17 @@ public function testCreateComment(Client $client): void

$addedComment = Model::getComment($id);

$this->assertEquals($id, $addedComment['id']);
$this->assertEquals($commentData['post_id'], $addedComment['post_id']);
$this->assertEquals($commentData['language'], $addedComment['language']);
$this->assertEquals($commentData['author'], $addedComment['author']);
$this->assertEquals($commentData['email'], $addedComment['email']);
$this->assertEquals($commentData['website'], $addedComment['website']);
$this->assertEquals($commentData['text'], $addedComment['text']);
$this->assertEquals($commentData['type'], $addedComment['type']);
$this->assertEquals($commentData['status'], $addedComment['status']);
$this->assertEquals($commentData['data'], $addedComment['data']);
$this->assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $addedComment['post_title']);
self::assertEquals($id, $addedComment['id']);
self::assertEquals($commentData['post_id'], $addedComment['post_id']);
self::assertEquals($commentData['language'], $addedComment['language']);
self::assertEquals($commentData['author'], $addedComment['author']);
self::assertEquals($commentData['email'], $addedComment['email']);
self::assertEquals($commentData['website'], $addedComment['website']);
self::assertEquals($commentData['text'], $addedComment['text']);
self::assertEquals($commentData['type'], $addedComment['type']);
self::assertEquals($commentData['status'], $addedComment['status']);
self::assertEquals($commentData['data'], $addedComment['data']);
self::assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $addedComment['post_title']);
}

public function testIfCommentExists(Client $client): void
@@ -62,8 +62,8 @@ public function testIfCommentExists(Client $client): void
]
);

$this->assertTrue(Model::existsComment(1));
$this->assertFalse(Model::existsComment(2));
self::assertTrue(Model::existsComment(1));
self::assertFalse(Model::existsComment(2));
}

public function testUpdateComment(Client $client): void
@@ -95,17 +95,17 @@ public function testUpdateComment(Client $client): void

$editedComment = Model::getComment(LoadBlogPostComments::BLOG_POST_COMMENT_ID);

$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_ID, $editedComment['id']);
$this->assertEquals($commentData['post_id'], $editedComment['post_id']);
$this->assertEquals($commentData['language'], $editedComment['language']);
$this->assertEquals($commentData['author'], $editedComment['author']);
$this->assertEquals($commentData['email'], $editedComment['email']);
$this->assertEquals($commentData['website'], $editedComment['website']);
$this->assertEquals($commentData['text'], $editedComment['text']);
$this->assertEquals($commentData['type'], $editedComment['type']);
$this->assertEquals($commentData['status'], $editedComment['status']);
$this->assertEquals($commentData['data'], $editedComment['data']);
$this->assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $editedComment['post_title']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_ID, $editedComment['id']);
self::assertEquals($commentData['post_id'], $editedComment['post_id']);
self::assertEquals($commentData['language'], $editedComment['language']);
self::assertEquals($commentData['author'], $editedComment['author']);
self::assertEquals($commentData['email'], $editedComment['email']);
self::assertEquals($commentData['website'], $editedComment['website']);
self::assertEquals($commentData['text'], $editedComment['text']);
self::assertEquals($commentData['type'], $editedComment['type']);
self::assertEquals($commentData['status'], $editedComment['status']);
self::assertEquals($commentData['data'], $editedComment['data']);
self::assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $editedComment['post_title']);
}

public function testGettingAllComments(Client $client): void
@@ -121,24 +121,24 @@ public function testGettingAllComments(Client $client): void

$comments = Model::getAllCommentsForStatus('published');

$this->assertCount(1, $comments);
self::assertCount(1, $comments);

$firstComment = $comments[0];

$this->assertEquals(1, $firstComment['post_id']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['post_id'], $firstComment['post_id']);
$this->assertEquals(
self::assertEquals(1, $firstComment['post_id']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['post_id'], $firstComment['post_id']);
self::assertEquals(
(string) strtotime(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['created_on'] . ' UTC'),
$firstComment['created_on']
);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['author'], $firstComment['author']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['email'], $firstComment['email']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['website'], $firstComment['website']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['text'], $firstComment['text']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['type'], $firstComment['type']);
$this->assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['status'], $firstComment['status']);
$this->assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $firstComment['post_title']);
$this->assertEquals(LoadBlogPosts::BLOG_POST_DATA['language'], $firstComment['post_language']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['author'], $firstComment['author']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['email'], $firstComment['email']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['website'], $firstComment['website']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['text'], $firstComment['text']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['type'], $firstComment['type']);
self::assertEquals(LoadBlogPostComments::BLOG_POST_COMMENT_DATA['status'], $firstComment['status']);
self::assertEquals(LoadBlogPosts::BLOG_POST_TITLE, $firstComment['post_title']);
self::assertEquals(LoadBlogPosts::BLOG_POST_DATA['language'], $firstComment['post_language']);
}

public function testDeleteComment(Client $client): void
@@ -152,9 +152,9 @@ public function testDeleteComment(Client $client): void
]
);

$this->assertTrue(Model::existsComment(1));
self::assertTrue(Model::existsComment(1));
Model::deleteComments([1]);
$this->assertFalse(Model::existsComment(1));
self::assertFalse(Model::existsComment(1));
}

// categories
@@ -166,10 +166,10 @@ public function testCreateCategory(): void
);
$createdCategory = Model::getCategory($id);

$this->assertArrayHasKey('meta_id', $createdCategory);
$this->assertEquals($id, $createdCategory['id']);
$this->assertEquals(LoadBlogCategories::BLOG_CATEGORY_DATA['language'], $createdCategory['language']);
$this->assertEquals(LoadBlogCategories::BLOG_CATEGORY_DATA['title'], $createdCategory['title']);
self::assertArrayHasKey('meta_id', $createdCategory);
self::assertEquals($id, $createdCategory['id']);
self::assertEquals(LoadBlogCategories::BLOG_CATEGORY_DATA['language'], $createdCategory['language']);
self::assertEquals(LoadBlogCategories::BLOG_CATEGORY_DATA['title'], $createdCategory['title']);
}

public function testIfCategoryExists(Client $client): void
@@ -180,9 +180,9 @@ public function testIfCategoryExists(Client $client): void
LoadBlogCategories::class,
]
);
$this->assertTrue(Model::existsCategory(1));
$this->assertTrue(Model::existsCategory(2));
$this->assertFalse(Model::existsCategory(1337));
self::assertTrue(Model::existsCategory(1));
self::assertTrue(Model::existsCategory(2));
self::assertFalse(Model::existsCategory(1337));
}

public function testUpdateCategory(Client $client): void
@@ -207,19 +207,19 @@ public function testUpdateCategory(Client $client): void
'language' => 'en',
];
$category = Model::getCategory(LoadBlogCategories::getCategoryId());
$this->assertEquals($newCategoryData['id'], $category['id']);
$this->assertEquals($categoryMetaData['id'], $category['meta_id']);
$this->assertEquals($newCategoryData['language'], $category['language']);
$this->assertNotEquals($newCategoryData['title'], $category['title']);
self::assertEquals($newCategoryData['id'], $category['id']);
self::assertEquals($categoryMetaData['id'], $category['meta_id']);
self::assertEquals($newCategoryData['language'], $category['language']);
self::assertNotEquals($newCategoryData['title'], $category['title']);

Model::updateCategory($newCategoryData, $categoryMetaData);

$updatedCategory = Model::getCategory(LoadBlogCategories::getCategoryId());

$this->assertEquals($newCategoryData['id'], $updatedCategory['id']);
$this->assertEquals($categoryMetaData['id'], $updatedCategory['meta_id']);
$this->assertEquals($newCategoryData['language'], $updatedCategory['language']);
$this->assertEquals($newCategoryData['title'], $updatedCategory['title']);
self::assertEquals($newCategoryData['id'], $updatedCategory['id']);
self::assertEquals($categoryMetaData['id'], $updatedCategory['meta_id']);
self::assertEquals($newCategoryData['language'], $updatedCategory['language']);
self::assertEquals($newCategoryData['title'], $updatedCategory['title']);
}

public function testDeleteCategory(Client $client): void
@@ -233,14 +233,14 @@ public function testDeleteCategory(Client $client): void

$id = LoadBlogCategories::getCategoryId();

$this->assertTrue(Model::existsCategory($id));
self::assertTrue(Model::existsCategory($id));
Model::deleteCategory($id);
$this->assertFalse(Model::existsCategory($id));
self::assertFalse(Model::existsCategory($id));
}

public function testCalculatingCategoryUrl(Client $client): void
{
$this->assertEquals(
self::assertEquals(
LoadBlogCategories::BLOG_CATEGORY_SLUG,
Model::getUrlForCategory(LoadBlogCategories::BLOG_CATEGORY_SLUG)
);
@@ -252,13 +252,13 @@ public function testCalculatingCategoryUrl(Client $client): void
]
);

$this->assertEquals(
self::assertEquals(
LoadBlogCategories::BLOG_CATEGORY_SLUG . '-2',
Model::getUrlForCategory(LoadBlogCategories::BLOG_CATEGORY_SLUG)
);

// check if the same url is returned when we pass the id
$this->assertEquals(
self::assertEquals(
LoadBlogCategories::BLOG_CATEGORY_SLUG,
Model::getUrlForCategory(
LoadBlogCategories::BLOG_CATEGORY_SLUG,
@@ -19,11 +19,11 @@ public function testInsertingFaqCategory(): void

$addedCategory = Model::getCategory($categoryId);

$this->assertEquals($categoryId, $addedCategory['id']);
$this->assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['language'], $addedCategory['language']);
$this->assertArrayHasKey('meta_id', $addedCategory);
$this->assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['title'], $addedCategory['title']);
$this->assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['sequence'], $addedCategory['sequence']);
self::assertEquals($categoryId, $addedCategory['id']);
self::assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['language'], $addedCategory['language']);
self::assertArrayHasKey('meta_id', $addedCategory);
self::assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['title'], $addedCategory['title']);
self::assertEquals(LoadFaqCategories::FAQ_CATEGORY_DATA['sequence'], $addedCategory['sequence']);
}

public function testIfCategoryExists(Client $client): void
@@ -35,14 +35,14 @@ public function testIfCategoryExists(Client $client): void
]
);

$this->assertTrue(Model::existsCategory(LoadFaqCategories::getCategoryId()));
$this->assertFalse(Model::existsCategory(99));
self::assertTrue(Model::existsCategory(LoadFaqCategories::getCategoryId()));
self::assertFalse(Model::existsCategory(99));
}

public function testGeneratingCategoryUrl(Client $client): void
{
// new url
$this->assertEquals(
self::assertEquals(
LoadFaqCategories::FAQ_CATEGORY_SLUG,
Model::getUrlForCategory(LoadFaqCategories::FAQ_CATEGORY_SLUG)
);
@@ -55,12 +55,12 @@ public function testGeneratingCategoryUrl(Client $client): void
);

// existing url, "2" is should be appended
$this->assertEquals(
self::assertEquals(
LoadFaqCategories::FAQ_CATEGORY_SLUG . '-2',
Model::getUrlForCategory(LoadFaqCategories::FAQ_CATEGORY_SLUG)
);
// existing url with id
$this->assertEquals(
self::assertEquals(
LoadFaqCategories::FAQ_CATEGORY_SLUG,
Model::getUrlForCategory(LoadFaqCategories::FAQ_CATEGORY_SLUG, LoadFaqCategories::getCategoryId())
);
@@ -97,10 +97,10 @@ public function testEditCategory(Client $client): void

$editedCategory = Model::getCategory($categoryData['id']);

$this->assertEquals($categoryData['id'], $editedCategory['id']);
$this->assertEquals($categoryMetaData['id'], $editedCategory['meta_id']);
$this->assertEquals($categoryData['language'], $editedCategory['language']);
$this->assertEquals($categoryData['title'], $editedCategory['title']);
self::assertEquals($categoryData['id'], $editedCategory['id']);
self::assertEquals($categoryMetaData['id'], $editedCategory['meta_id']);
self::assertEquals($categoryData['language'], $editedCategory['language']);
self::assertEquals($categoryData['title'], $editedCategory['title']);
}

public function testDeleteCategory(Client $client): void
@@ -113,8 +113,8 @@ public function testDeleteCategory(Client $client): void
);

$id = LoadFaqCategories::getCategoryId();
$this->assertTrue(Model::existsCategory($id));
self::assertTrue(Model::existsCategory($id));
Model::deleteCategory($id);
$this->assertFalse(Model::existsCategory($id));
self::assertFalse(Model::existsCategory($id));
}
}
@@ -29,7 +29,7 @@ public function testLocalStorageProvider(): void
);

$this->storageManager->addStorageProvider($localStorageProvider, 'local');
$this->assertEquals(
self::assertEquals(
$this->storageManager->getStorageProvider(StorageType::local()),
$localStorageProvider
);
@@ -42,7 +42,7 @@ public function testYoutubeStorageProvider(): void
'https://www.youtube.com/embed/'
);
$this->storageManager->addStorageProvider($youtubeStorageProvider, 'youtube');
$this->assertEquals(
self::assertEquals(
$this->storageManager->getStorageProvider(StorageType::youtube()),
$youtubeStorageProvider
);
@@ -55,7 +55,7 @@ public function testVimeoStorageProvider(): void
'https://player.vimeo.com/video/'
);
$this->storageManager->addStorageProvider($vimeoStorageProvider, 'vimeo');
$this->assertEquals(
self::assertEquals(
$this->storageManager->getStorageProvider(StorageType::vimeo()),
$vimeoStorageProvider
);

0 comments on commit f3054c5

Please sign in to comment.
You can’t perform that action at this time.