Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pquery
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Taddeüs Kroes
pquery
Commits
593e7f77
Commit
593e7f77
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added some tests for array plugin.
parent
21f7f487
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
pquery.array.php
+10
-4
10 additions, 4 deletions
pquery.array.php
test/test_array.php
+8
-2
8 additions, 2 deletions
test/test_array.php
todo.txt
+0
-1
0 additions, 1 deletion
todo.txt
with
18 additions
and
7 deletions
pquery.array.php
+
10
−
4
View file @
593e7f77
...
...
@@ -30,6 +30,15 @@ class pQueryArray extends pQuery implements pQueryExtension {
return
!
$this
->
count
();
}
/**
* Get the number of elementsin the array.
*
* @returns int The number of elements.
*/
function
count
()
{
return
count
(
$this
->
variable
);
}
/**
* Reverse the array.
*
...
...
@@ -58,10 +67,7 @@ class pQueryArray extends pQuery implements pQueryExtension {
return
call_user_func_array
(
$function
,
$args
);
}
if
(
in_array
(
$method
,
array
(
'count'
))
)
return
$method
(
$this
->
variable
);
if
(
in_array
(
$method
,
array
(
'shuffle'
))
)
{
if
(
in_array
(
$method
,
array
(
'shuffle'
,
'sort'
))
)
{
$method
(
$this
->
variable
);
return
$this
;
}
...
...
This diff is collapsed.
Click to expand it.
test/test_array.php
+
8
−
2
View file @
593e7f77
...
...
@@ -43,8 +43,14 @@ class pQueryArrayTest extends UnitTestCase {
$this
->
assertEqual
(
$arr
->
reverse
()
->
variable
,
$reverse
,
'reverse is not really reverse...'
);
}
function
test_call
()
{
function
test_call_count
()
{
$this
->
assertEqual
(
$this
->
arr
->
count
(),
count
(
$this
->
variable
));
}
function
test_call_sort
()
{
$arr
=
range
(
1
,
8
);
shuffle
(
$arr
);
$this
->
assertEqual
(
_arr
(
$arr
)
->
sort
()
->
variable
,
range
(
1
,
8
));
}
}
...
...
This diff is collapsed.
Click to expand it.
todo.txt
+
0
−
1
View file @
593e7f77
- Extend array plugin with stack/collection functions.
- Unit test array plugin
- Unit test base
- Unit test cache plugin
- Unit test css plugin
...
...
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