Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
caldera-forms-query
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
cf-dependencies
caldera-forms-query
Commits
05a38e51
Commit
05a38e51
authored
6 years ago
by
Josh Pollock
Browse files
Options
Downloads
Patches
Plain Diff
add a static accessor function for container
parent
9057feeb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Tests/Integration/FunctionsTest.php
+31
-0
31 additions, 0 deletions
Tests/Integration/FunctionsTest.php
composer.json
+2
-1
2 additions, 1 deletion
composer.json
src/CalderaFormsQueries.php
+27
-0
27 additions, 0 deletions
src/CalderaFormsQueries.php
with
60 additions
and
1 deletion
Tests/Integration/FunctionsTest.php
0 → 100644
+
31
−
0
View file @
05a38e51
<?php
namespace
calderawp\CalderaFormsQuery\Tests\Integration
;
use
function
calderawp\CalderaFormsQueries\CalderaFormsQueries
;
use
calderawp\CalderaFormsQuery\Features\FeatureContainer
;
class
FunctionsTest
extends
IntegrationTestCase
{
/**
* Ensure that accessor function returns the right class type
* @covers CalderaFormsQueries()
*/
public
function
testGetMainInstance
()
{
$this
->
assertSame
(
FeatureContainer
::
class
,
get_class
(
CalderaFormsQueries
())
);
}
/**
* Ensure that accessor function returns the same class instance
* @covers CalderaFormsQueries()
*/
public
function
testIsSameInstance
()
{
$this
->
assertSame
(
CalderaFormsQueries
(),
CalderaFormsQueries
()
);
CalderaFormsQueries
()
->
set
(
'sivan'
,
'roy'
);
$this
->
assertEquals
(
'roy'
,
CalderaFormsQueries
()
->
get
(
'sivan'
)
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
composer.json
+
2
−
1
View file @
05a38e51
...
...
@@ -22,7 +22,8 @@
"autoload"
:
{
"psr-4"
:
{
"calderawp\\CalderaFormsQuery\\"
:
"src"
}
},
"files"
:
[
"src/CalderaFormsQueries.php"
]
},
"scripts"
:
{
"tests"
:
"composer unit-tests && composer wp-tests"
,
...
...
This diff is collapsed.
Click to expand it.
src/CalderaFormsQueries.php
0 → 100644
+
27
−
0
View file @
05a38e51
<?php
namespace
calderawp\CalderaFormsQueries
;
use
calderawp\CalderaContainers\Service\Container
;
use
calderawp\CalderaFormsQuery\Features\FeatureContainer
;
/**
* The CalderaFormsQueries
*
* Acts as static accessor for feature container
*
* @return FeatureContainer
*/
function
CalderaFormsQueries
()
{
static
$CalderaFormsQueries
;
if
(
!
$CalderaFormsQueries
){
global
$wpdb
;
$CalderaFormsQueries
=
new
FeatureContainer
(
new
Container
(),
$wpdb
);
}
return
$CalderaFormsQueries
;
}
\ No newline at end of file
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