Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-notice
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-notice
Commits
47e8eac3
Commit
47e8eac3
authored
6 years ago
by
Grzegorz Rola
Browse files
Options
Downloads
Patches
Plain Diff
Added factory, functions, and changed order of parameters.
parent
8b1be169
No related branches found
No related tags found
1 merge request
!4
Feature/factory
Pipeline
#7419
passed
6 years ago
Stage: tools
Stage: tests
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/WPDesk/functions.php
+38
-10
38 additions, 10 deletions
src/WPDesk/functions.php
tests/integration/TestFunctions.php
+2
-2
2 additions, 2 deletions
tests/integration/TestFunctions.php
with
40 additions
and
12 deletions
src/WPDesk/functions.php
+
38
−
10
View file @
47e8eac3
...
@@ -3,25 +3,39 @@
...
@@ -3,25 +3,39 @@
/**
/**
* Creates Notice.
* Creates Notice.
*
*
* @param $noticeContent
* @param
string
$noticeContent
Notice content.
* @param string $noticeType
* @param string $noticeType
Notice type.
* @param bool
$is
Dismissible
* @param bool
$dismissible
Dismissible
notice.
* @param int $priority
* @param int
$priority
Notice priority,
*
*
* @return \WPDesk\Notice\Notice
* @return \WPDesk\Notice\Notice
*/
*/
function
WPDeskNotice
(
$noticeContent
,
$noticeType
=
'info'
,
$
isD
ismissible
=
false
,
$priority
=
10
)
function
WPDeskNotice
(
$noticeContent
,
$noticeType
=
'info'
,
$
d
ismissible
=
false
,
$priority
=
10
)
{
{
return
\WPDesk\Notice\Factory
::
notice
(
$noticeContent
,
$noticeType
,
$
isD
ismissible
,
$priority
);
return
\WPDesk\Notice\Factory
::
notice
(
$noticeContent
,
$noticeType
,
$
d
ismissible
,
$priority
);
}
}
/**
/**
* Creates Notice.
* Creates Notice.
*
*
* @param $noticeContent
* @param string $noticeContent Notice content.
* @param string $noticeType
* @param string $noticeType Notice type.
* @param bool $isDismissible
* @param bool $dismissible Dismissible notice.
* @param int $priority
* @param int $priority Notice priority,
*
* @return \WPDesk\Notice\Notice
*/
function
wpdesk_notice
(
$noticeContent
,
$noticeType
=
'info'
,
$dismissible
=
false
,
$priority
=
10
)
{
return
WPDeskNotice
(
$noticeContent
,
$noticeType
,
$dismissible
,
$priority
);
}
/**
* Creates Permanent Dismissible Notice.
*
* @param string $noticeContent Notice content.
* @param string $noticeType Notice type.
* @param int $priority Notice priority.
*
*
* @return \WPDesk\Notice\Notice
* @return \WPDesk\Notice\Notice
*/
*/
...
@@ -29,3 +43,17 @@ function WPDeskPermanentDismissibleNotice($noticeContent, $noticeType = 'info',
...
@@ -29,3 +43,17 @@ function WPDeskPermanentDismissibleNotice($noticeContent, $noticeType = 'info',
{
{
return
\WPDesk\Notice\Factory
::
permanentDismissibleNotice
(
$noticeContent
,
$noticeType
,
$priority
);
return
\WPDesk\Notice\Factory
::
permanentDismissibleNotice
(
$noticeContent
,
$noticeType
,
$priority
);
}
}
/**
* Creates Permanent Dismissible Notice.
*
* @param string $noticeContent Notice content.
* @param string $noticeType Notice type.
* @param int $priority Notice priority.
*
* @return \WPDesk\Notice\Notice
*/
function
wpdesk_permanent_dismissible_notice
(
$noticeContent
,
$noticeType
=
'info'
,
$priority
=
10
)
{
return
WPDeskPermanentDismissibleNotice
(
$noticeContent
,
$noticeType
,
$priority
);
}
This diff is collapsed.
Click to expand it.
tests/integration/TestFunctions.php
+
2
−
2
View file @
47e8eac3
...
@@ -14,7 +14,7 @@ class TestFunctions extends WP_UnitTestCase
...
@@ -14,7 +14,7 @@ class TestFunctions extends WP_UnitTestCase
*/
*/
public
function
testWPDeskNotice
()
public
function
testWPDeskNotice
()
{
{
$notice
=
WPD
esk
N
otice
(
'test'
);
$notice
=
wpd
esk
_n
otice
(
'test'
);
$this
->
assertInstanceOf
(
Notice
::
class
,
$notice
);
$this
->
assertInstanceOf
(
Notice
::
class
,
$notice
);
}
}
...
@@ -24,7 +24,7 @@ class TestFunctions extends WP_UnitTestCase
...
@@ -24,7 +24,7 @@ class TestFunctions extends WP_UnitTestCase
*/
*/
public
function
testWPDeskPermanentDismissibleNotice
()
public
function
testWPDeskPermanentDismissibleNotice
()
{
{
$notice
=
WPD
esk
P
ermanent
D
ismissible
N
otice
(
'test'
);
$notice
=
wpd
esk
_p
ermanent
_d
ismissible
_n
otice
(
'test'
);
$this
->
assertInstanceOf
(
PermanentDismissibleNotice
::
class
,
$notice
);
$this
->
assertInstanceOf
(
PermanentDismissibleNotice
::
class
,
$notice
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment