Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"webmozart/assert": "^2.3"
},
"config": {
"allow-plugins": {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Behat/BrowserContext/BookmarkContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Behat\Behat\Context\Context;
use Ibexa\AdminUi\Behat\Page\BookmarksPage;
use Ibexa\AdminUi\Behat\Page\ContentViewPage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class BookmarkContext implements Context
{
Expand All @@ -36,23 +36,23 @@ public function bookmarkContentItem(string $path): void
*/
public function contentItemIsBookmarked(): void
{
Assert::assertTrue($this->contentViewPage->isBookmarked());
Assert::true($this->contentViewPage->isBookmarked());
}

/**
* @Given there's a :contentName Content Item on Bookmarks list
*/
public function contentItemIsDisplayed(string $contentName): void
{
Assert::assertTrue($this->bookmarksPage->isBookmarked($contentName));
Assert::true($this->bookmarksPage->isBookmarked($contentName));
}

/**
* @Given there's no :contentName Content Item on Bookmarks list
*/
public function contentItemIsNotDisplayed(string $contentName): void
{
Assert::assertFalse($this->bookmarksPage->isBookmarked($contentName));
Assert::false($this->bookmarksPage->isBookmarked($contentName));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Behat/BrowserContext/ContentActionsMenuContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use Ibexa\AdminUi\Behat\Component\ContentActionsMenu;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class ContentActionsMenuContext implements Context
{
Expand All @@ -35,7 +35,7 @@ public function clickEditActionBar(string $buttonName, ?string $groupName = null
public function theButtonsAreDisabled(TableNode $buttons): void
{
foreach ($buttons->getHash() as $button) {
Assert::assertFalse($this->contentActionsMenu->isButtonActive($button['buttonName']));
Assert::false($this->contentActionsMenu->isButtonActive($button['buttonName']));
}
}

Expand All @@ -44,14 +44,14 @@ public function theButtonsAreDisabled(TableNode $buttons): void
*/
public function buttonIsNotVisible(string $buttonName): void
{
Assert::assertFalse($this->contentActionsMenu->isButtonVisible($buttonName));
Assert::false($this->contentActionsMenu->isButtonVisible($buttonName));
}

/**
* @Given the :buttonName button is visible
*/
public function buttonIsVisible(string $buttonName): void
{
Assert::assertTrue($this->contentActionsMenu->isButtonVisible($buttonName));
Assert::true($this->contentActionsMenu->isButtonVisible($buttonName));
}
}
22 changes: 11 additions & 11 deletions src/lib/Behat/BrowserContext/ContentTypeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Ibexa\AdminUi\Behat\Page\ContentTypeGroupsPage;
use Ibexa\AdminUi\Behat\Page\ContentTypePage;
use Ibexa\AdminUi\Behat\Page\ContentTypeUpdatePage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class ContentTypeContext implements Context
{
Expand All @@ -32,7 +32,7 @@ public function __construct(
public function contentTypeHasProperGlobalProperties(TableNode $table): void
{
foreach ($table->getHash() as $row) {
Assert::assertTrue($this->contentTypePage->hasProperty($row['label'], $row['value']));
Assert::true($this->contentTypePage->hasProperty($row['label'], $row['value']));
}
}

Expand All @@ -58,7 +58,7 @@ public function createNewContentTypeGroup(): void
public function contentTypeHasProperFields(TableNode $table): void
{
foreach ($table->getHash() as $row) {
Assert::assertTrue($this->contentTypePage->hasFieldType(
Assert::true($this->contentTypePage->hasFieldType(
['Name' => $row['fieldName'], 'Type' => $row['fieldType']]
));
}
Expand All @@ -69,31 +69,31 @@ public function contentTypeHasProperFields(TableNode $table): void
*/
public function thereSNoOnContentTypesList(string $contentTypeName): void
{
Assert::assertFalse($this->contentTypeGroupPage->isContentTypeOnTheList($contentTypeName));
Assert::false($this->contentTypeGroupPage->isContentTypeOnTheList($contentTypeName));
}

/**
* @Given there's no :contentTypeGroupName content type group on content type groups list
*/
public function thereSNoOnContentTypesGroupList(string $contentTypeGroupName): void
{
Assert::assertFalse($this->contentTypeGroupsPage->isContentTypeGroupOnTheList($contentTypeGroupName));
Assert::false($this->contentTypeGroupsPage->isContentTypeGroupOnTheList($contentTypeGroupName));
}

/**
* @Given there's a :contentTypeGroupName content type group on content type groups list
*/
public function thereSAOnContentTypesGroupList(string $contentTypeGroupName): void
{
Assert::assertTrue($this->contentTypeGroupsPage->isContentTypeGroupOnTheList($contentTypeGroupName));
Assert::true($this->contentTypeGroupsPage->isContentTypeGroupOnTheList($contentTypeGroupName));
}

/**
* @Given there's a :contentTypeName on content types list
*/
public function thereAContentTypeOnContentTypesList(string $contentTypeName): void
{
Assert::assertTrue($this->contentTypeGroupPage->isContentTypeOnTheList($contentTypeName));
Assert::true($this->contentTypeGroupPage->isContentTypeOnTheList($contentTypeName));
}

/**
Expand Down Expand Up @@ -187,31 +187,31 @@ public function iShouldBeOnContentTypePage(string $contentTypeName): void
*/
public function thereAreNoContentTypes(): void
{
Assert::assertFalse($this->contentTypeGroupPage->hasContentTypes());
Assert::false($this->contentTypeGroupPage->hasContentTypes());
}

/**
* @Then there's an empty :contentTypeGroupName content type group on content type groups list
*/
public function thereIsAnEmptyContentTypeGroup(string $contentTypeGroupName): void
{
Assert::assertFalse($this->contentTypeGroupPage->hasAssignedContentItems($contentTypeGroupName));
Assert::false($this->contentTypeGroupPage->hasAssignedContentItems($contentTypeGroupName));
}

/**
* @Then there's non-empty :contentTypeGroupName content type group on content type groups list
*/
public function thereIsANonEmptyContentTypeGroup(string $contentTypeGroupName): void
{
Assert::assertTrue($this->contentTypeGroupPage->hasAssignedContentItems($contentTypeGroupName));
Assert::true($this->contentTypeGroupPage->hasAssignedContentItems($contentTypeGroupName));
}

/**
* @Then content type group :contentTypeGroupName cannot be selected
*/
public function contentTypeGroupCannotBeSelected(string $contentTypeGroupName): void
{
Assert::assertFalse($this->contentTypeGroupsPage->canBeSelected($contentTypeGroupName));
Assert::false($this->contentTypeGroupsPage->canBeSelected($contentTypeGroupName));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Behat/BrowserContext/ContentUpdateContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Ibexa\AdminUi\Behat\Component\Fields\NonEditableField;
use Ibexa\AdminUi\Behat\Page\ContentUpdateItemPage;
use Ibexa\AdminUi\Behat\Page\UserUpdatePage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class ContentUpdateContext implements Context
{
Expand Down Expand Up @@ -50,7 +50,7 @@ public function fieldContainsValidationError(string $fieldName, string $errorMes
public function verifyFieldIsNotEditable(string $fieldName): void
{
$field = $this->contentUpdateItemPage->getField($fieldName);
Assert::assertEquals(NonEditableField::EXPECTED_NON_EDITABLE_TEXT, $field->getValue()[0]);
Assert::eq($field->getValue()[0], NonEditableField::EXPECTED_NON_EDITABLE_TEXT);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Behat/BrowserContext/ContentViewContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Ibexa\AdminUi\Behat\Component\DraftConflictDialog;
use Ibexa\AdminUi\Behat\Page\ContentViewPage;
use Ibexa\Behat\Core\Behat\ArgumentParser;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class ContentViewContext implements Context
{
Expand Down Expand Up @@ -107,7 +107,7 @@ public function startEditingContent(?string $language = null): void
public function verifyThereIsItemInSubItemList(string $itemName, string $itemType): void
{
$this->contentViewPage->verifyIsLoaded();
Assert::assertTrue($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType]));
Assert::true($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType]));
}

/**
Expand All @@ -116,7 +116,7 @@ public function verifyThereIsItemInSubItemList(string $itemName, string $itemTyp
public function verifyThereIsNoItemInSubItemListInRoot(string $itemName, string $itemType): void
{
$this->contentViewPage->verifyIsLoaded();
Assert::assertFalse($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType]));
Assert::false($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType]));
}

/**
Expand Down Expand Up @@ -181,7 +181,7 @@ public function iCreateNewUrlAlias(string $path, string $languageName, string $r
*/
public function verifyUrlAliasExists(string $path, string $type): void
{
Assert::assertTrue(
Assert::true(
$this->contentViewPage->isUrlAliasOnTheList($path, $type),
sprintf('Url alias "%s" with type "%s" not found', $path, $type)
);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Behat/BrowserContext/DashboardContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Ibexa\AdminUi\Behat\Component\UpperMenu;
use Ibexa\AdminUi\Behat\Page\ContentUpdateItemPage;
use Ibexa\AdminUi\Behat\Page\DashboardPage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class DashboardContext implements Context
{
Expand All @@ -36,15 +36,15 @@ public function iGoToDashboard(): void
*/
public function goingToDashboardISeeDraft(string $draftName): void
{
Assert::assertTrue($this->dashboardPage->isDraftOnList($draftName));
Assert::true($this->dashboardPage->isDraftOnList($draftName));
}

/**
* @Then there's no draft :draftName on Dashboard list
*/
public function goingToDashboardISeeNoDraft(string $draftName): void
{
Assert::assertFalse($this->dashboardPage->isDraftOnList($draftName));
Assert::false($this->dashboardPage->isDraftOnList($draftName));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Behat/BrowserContext/LanguageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Behat\Gherkin\Node\TableNode;
use Ibexa\AdminUi\Behat\Page\LanguagePage;
use Ibexa\AdminUi\Behat\Page\LanguagesPage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class LanguageContext implements Context
{
Expand All @@ -35,7 +35,7 @@ public function deleteLanguage(): void
*/
public function thereSNoLanguageOnLanguageList(string $languageName): void
{
Assert::assertFalse($this->languagesPage->isLanguageOnTheList($languageName));
Assert::false($this->languagesPage->isLanguageOnTheList($languageName));
}

/**
Expand All @@ -51,7 +51,7 @@ public function deleteLanguageNamed(string $languageName): void
*/
public function thereALanguageOnLanguageList(string $languageName): void
{
Assert::assertTrue($this->languagesPage->isLanguageOnTheList($languageName));
Assert::true($this->languagesPage->isLanguageOnTheList($languageName));
}

/**
Expand All @@ -72,7 +72,7 @@ public function languageHasProperAttributes(TableNode $languageData): void
$expectedCode = $languageData->getHash()[0]['Language code'];
$expectedEnabledFlag = $languageData->getHash()[0]['Enabled'];

Assert::assertTrue(
Assert::true(
$this->languagePage->hasProperties([
'Name' => $expectedName,
'Language code' => $expectedCode,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Behat/BrowserContext/MyDraftsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Behat\Behat\Context\Context;
use Ibexa\AdminUi\Behat\Page\MyDraftsPage;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

final readonly class MyDraftsContext implements Context
{
Expand All @@ -32,7 +32,7 @@ public function iDeleteADraftFromTheList(string $draftName): void
*/
public function iSeeTheDraftIsDeleted(string $draftName): void
{
Assert::assertFalse($this->myDraftsPage->isDraftOnTheList($draftName));
Assert::false($this->myDraftsPage->isDraftOnTheList($draftName));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Behat/BrowserContext/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Behat\Behat\Context\Context;
use Ibexa\AdminUi\Behat\Component\Notification;
use PHPUnit\Framework\Assert;
use Webmozart\Assert\Assert;

/** Context for actions on notifications */
final readonly class NotificationContext implements Context
Expand All @@ -29,7 +29,7 @@ public function notificationAppears(string $itemType, string $itemName, string $

$this->notification->verifyIsLoaded();
$this->notification->verifyAlertSuccess();
Assert::assertEquals($expectedMessage, $this->notification->getMessage());
Assert::eq($this->notification->getMessage(), $expectedMessage);
$this->notification->closeAlert();
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public function specificErrorNotificationAppears(string $message): void
{
$this->notification->verifyIsLoaded();
$this->notification->verifyAlertFailure();
Assert::assertStringContainsString($message, $this->notification->getMessage());
Assert::contains($this->notification->getMessage(), $message);
$this->notification->closeAlert();
}
}
Loading
Loading