Skip to content

Commit

Permalink
Fix more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Mar 18, 2024
1 parent 2558559 commit 153d7f9
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 47 deletions.
83 changes: 81 additions & 2 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,86 @@
preset: psr2
preset: psr12
risky: true

version: 8.1

finder:
exclude:
- docs
- tests/_support
- vendor

enabled:
- alpha_ordered_traits
- array_indentation
- array_push
- combine_consecutive_issets
- combine_consecutive_unsets
- combine_nested_dirname
- declare_strict_types
- dir_constant
- empty_loop_body_braces
- fully_qualified_strict_types
- function_to_constant
- hash_to_slash_comment
- integer_literal_case
- is_null
- logical_operators
- magic_constant_casing
- magic_method_casing
- method_separation
- modernize_types_casting
- native_function_casing
- native_function_type_declaration_casing
- no_alias_functions
- no_empty_comment
- no_empty_phpdoc
- no_empty_statement
- no_extra_block_blank_lines
- no_short_bool_cast
- no_superfluous_elseif
- no_unneeded_control_parentheses
- no_unneeded_curly_braces
- no_unneeded_final_method
- no_unset_cast
- no_unused_imports
- no_unused_lambda_imports
- no_useless_else
- no_useless_return
- normalize_index_brace
- php_unit_dedicate_assert
- php_unit_dedicate_assert_internal_type
- php_unit_expectation
- php_unit_mock
- php_unit_mock_short_will_return
- php_unit_namespaced
- php_unit_no_expectation_annotation
- phpdoc_no_empty_return
- phpdoc_no_useless_inheritdoc
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
- phpdoc_type_to_var
- phpdoc_types
- phpdoc_types_order
- print_to_echo
- regular_callable_call
- return_assignment
- self_accessor
- self_static_accessor
- set_type_to_cast
- short_array_syntax
- short_list_syntax
- simplified_if_return
- single_quote
- standardize_not_equals
- ternary_to_null_coalescing
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- union_type_without_spaces

disabled:
- function_declaration
- psr12_braces
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"sjaakp/yii2-icon": "^1.0",
"ui-awesome/html": "^0.1",
"ui-awesome/html-component": "^0.1",
"ui-awesome/html-helper":"^0.1",
"yii2-extensions/asset-bootstrap5": "^0.1",
"yii2-extensions/bootstrap5": "^0.1",
"yii2-extensions/localeurls": "dev-main",
Expand Down
4 changes: 1 addition & 3 deletions src/Framework/resource/layout/component/alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

use UIAwesome\Html\Component\Alert;
use UIAwesome\Html\Component\Cookbook\BootstrapAlertDismiss;
use UIAwesome\Html\Group\Div;
use UIAwesome\Html\{Component\Alert, Component\Cookbook\BootstrapAlertDismiss, Group\Div};

$session = Yii::$app->getSession();
$flashMessages = $session->getAllFlashes();
Expand Down
3 changes: 1 addition & 2 deletions src/Framework/resource/layout/component/footer-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

declare(strict_types=1);

use UIAwesome\Html\Graphic\Svg;
use UIAwesome\Html\Textual\A;
use UIAwesome\Html\{Graphic\Svg, Textual\A};

$linkIconDefinitions = [
'class()' => ['d-none d-sm-block d-md-block d-lg-block d-xl-block text-muted hover:text-dark text-decoration-none ms-3'],
Expand Down
16 changes: 8 additions & 8 deletions src/Framework/resource/layout/component/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

declare(strict_types=1);

use UIAwesome\Html\Component\Cookbook\BootstrapNavBarMenuItemsRigth;
use UIAwesome\Html\Component\Item;
use UIAwesome\Html\Component\Menu;
use UIAwesome\Html\Component\NavBar;
use UIAwesome\Html\Multimedia\Img;
use yii\helpers\Url;
use yii\web\User;
use UIAwesome\Html\{
Component\Cookbook\BootstrapNavBarMenuItemsRigth,
Component\Item,
Component\Menu,
Component\NavBar,
Multimedia\Img
};
use yii\{helpers\Url, web\User};

$user = null;

Expand Down Expand Up @@ -51,6 +52,5 @@
Menu::widget()
->currentPath(Yii::$app->request->url)
->items(...$items)
->linkActiveClass('active')
)
->render();
7 changes: 2 additions & 5 deletions src/Framework/resource/layout/component/toggle_language.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
declare(strict_types=1);

use App\Framework\Asset\LocaleAsset;
use UIAwesome\Html\Component\Cookbook\BootstrapDropdownLanguage;
use UIAwesome\Html\Component\Dropdown;
use UIAwesome\Html\Component\Item;
use yii\helpers\Url;
use yii\web\View;
use UIAwesome\Html\Component\{Cookbook\BootstrapDropdownLanguage, Dropdown, Item};
use yii\{helpers\Url, web\View};

/**
* @var string $languageLabel
Expand Down
14 changes: 8 additions & 6 deletions src/Framework/resource/layout/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
declare(strict_types=1);

use App\Framework\Asset\ToggleThemeAsset;
use UIAwesome\Html\Component\Cookbook\BootstrapToggleTheme;
use UIAwesome\Html\Component\Toggle;
use UIAwesome\Html\Group\Div;
use UIAwesome\Html\Semantic\Footer;
use UIAwesome\Html\Textual\A;
use UIAwesome\Html\Textual\Span;
use UIAwesome\Html\{
Component\Cookbook\BootstrapToggleTheme,
Component\Toggle,
Group\Div,
Semantic\Footer,
Textual\A,
Textual\Span
};
use yii\web\View;

/**
Expand Down
5 changes: 1 addition & 4 deletions src/UseCase/Site/view/404.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

declare(strict_types=1);

use UIAwesome\Html\Group\Div;
use UIAwesome\Html\Helper\Encode;
use UIAwesome\Html\Multimedia\Img;
use UIAwesome\Html\Semantic\H;
use UIAwesome\Html\{Group\Div, Helper\Encode, Multimedia\Img, Semantic\H};
use yii\web\View;

/**
Expand Down
6 changes: 1 addition & 5 deletions src/UseCase/Site/view/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

declare(strict_types=1);

use UIAwesome\Html\Group\Div;
use UIAwesome\Html\Group\P;
use UIAwesome\Html\Helper\Encode;
use UIAwesome\Html\Semantic\H;
use UIAwesome\Html\Tag;
use UIAwesome\Html\{Group\Div, Group\P, Helper\Encode, Semantic\H, Tag};
use yii\web\View;

/**
Expand Down
5 changes: 1 addition & 4 deletions src/UseCase/Site/view/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

declare(strict_types=1);

use UIAwesome\Html\Group\Div;
use UIAwesome\Html\Group\P;
use UIAwesome\Html\Helper\Encode;
use UIAwesome\Html\Semantic\H;
use UIAwesome\Html\{Group\Div, Group\P, Helper\Encode, Semantic\H};
use yii\web\View;

/**
Expand Down
12 changes: 4 additions & 8 deletions tests/Unit/MenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Tests\Support\Data\UserIdentity;
use Codeception\Test\Unit;
use Yii;
use yii\web\Request;
use yii\web\User;
use yii\web\View;

Expand All @@ -18,20 +19,15 @@ public function testMenu(): void
{
$view = new View();

Yii::$container->set(
User::class,
[
'identityClass' => UserIdentity::class,
]
);

Yii::$app->request->setUrl('http://example.com');
Yii::$app->params['app.menu.islogged'] = [
[
'label' => 'Logout',
'url' => ['/logout/index'],
'link' => ['/logout/index'],
'order' => 1,
],
];
Yii::$container->set(User::class, ['identityClass' => UserIdentity::class]);

$user = Yii::$container->get(User::class);
$user->login(UserIdentity::findIdentity('user1'), 0);
Expand Down

0 comments on commit 153d7f9

Please sign in to comment.