Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pquery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
pquery
Commits
bc5247fd
Commit
bc5247fd
authored
Dec 05, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added assertion of constant existance.
parent
e4ec329a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
7 deletions
+22
-7
pquery.php
pquery.php
+21
-1
test/config.php
test/config.php
+0
-5
test/index.php
test/index.php
+1
-1
No files found.
pquery.php
View file @
bc5247fd
...
...
@@ -273,10 +273,28 @@ class pQuery {
include_once
$path
;
}
}
/**
* Assert that the given constants have been defined. Add the prefix 'PQUERY_' to each constant name.
*/
static
function
assert_defined
(
/* $constant1 [ , $constant2, ... ] */
)
{
$constants
=
func_get_args
();
$undefined
=
array
();
foreach
(
$constants
as
$constant
)
{
$constant
=
'PQUERY_'
.
$constant
;
if
(
!
defined
(
$constant
)
)
$undefined
[]
=
$constant
;
}
count
(
$undefined
)
&&
self
::
error
(
'The following constants have'
.
' not been defined: %s'
,
implode
(
', '
,
$undefined
));
}
}
/**
* Exception class for error throwing
* Exception class for error throwing
.
*/
class
pQueryException
extends
Exception
{
...
...
@@ -330,5 +348,7 @@ class_alias('pQuery', '__p');
* Set the exception handler
*/
set_exception_handler
(
'__p::exception_handler'
);
__p
::
assert_defined
(
'DEBUG'
,
'ROOT'
);
?>
\ No newline at end of file
test/config.php
View file @
bc5247fd
<?php
/**
* Base and plugin config for pQuery utility framework.
*
* @package pQuery
*/
/**
* Indicates whether the framework is in debug mode, which right
...
...
test/index.php
View file @
bc5247fd
...
...
@@ -2,7 +2,7 @@
include_once
'../../simpletest/autorun.php'
;
include_once
'config.php'
;
include_once
PQUERY_ROOT
.
'
pquery.php'
;
include_once
'../
pquery.php'
;
function
is_test_file
(
$filename
)
{
return
preg_match
(
'/^test_\w+\.php$/'
,
$filename
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment