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
593e7f77
Commit
593e7f77
authored
Dec 06, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some tests for array plugin.
parent
21f7f487
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
pquery.array.php
pquery.array.php
+10
-4
test/test_array.php
test/test_array.php
+8
-2
todo.txt
todo.txt
+0
-1
No files found.
pquery.array.php
View file @
593e7f77
...
@@ -30,6 +30,15 @@ class pQueryArray extends pQuery implements pQueryExtension {
...
@@ -30,6 +30,15 @@ class pQueryArray extends pQuery implements pQueryExtension {
return
!
$this
->
count
();
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.
* Reverse the array.
*
*
...
@@ -58,10 +67,7 @@ class pQueryArray extends pQuery implements pQueryExtension {
...
@@ -58,10 +67,7 @@ class pQueryArray extends pQuery implements pQueryExtension {
return
call_user_func_array
(
$function
,
$args
);
return
call_user_func_array
(
$function
,
$args
);
}
}
if
(
in_array
(
$method
,
array
(
'count'
))
)
if
(
in_array
(
$method
,
array
(
'shuffle'
,
'sort'
))
)
{
return
$method
(
$this
->
variable
);
if
(
in_array
(
$method
,
array
(
'shuffle'
))
)
{
$method
(
$this
->
variable
);
$method
(
$this
->
variable
);
return
$this
;
return
$this
;
}
}
...
...
test/test_array.php
View file @
593e7f77
...
@@ -43,8 +43,14 @@ class pQueryArrayTest extends UnitTestCase {
...
@@ -43,8 +43,14 @@ class pQueryArrayTest extends UnitTestCase {
$this
->
assertEqual
(
$arr
->
reverse
()
->
variable
,
$reverse
,
'reverse is not really reverse...'
);
$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
));
}
}
}
}
...
...
todo.txt
View file @
593e7f77
- Extend array plugin with stack/collection functions.
- Extend array plugin with stack/collection functions.
- Unit test array plugin
- Unit test base
- Unit test base
- Unit test cache plugin
- Unit test cache plugin
- Unit test css plugin
- Unit test css plugin
...
...
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