Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
xmlsitemap
Commits
88b0a3a9
Commit
88b0a3a9
authored
Feb 01, 2010
by
Dave Reid
Browse files
by Dave Reid: Merged Drupal 6 test improvements.
parent
27ee5c4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
xmlsitemap.test
View file @
88b0a3a9
...
...
@@ -191,10 +191,11 @@ class XMLSitemapTestHelper extends DrupalWebTestCase {
*
* @todo Add unit tests for this function.
*/
protected
function
getWatchdogMessages
(
array
$conditions
=
array
(),
$
exclude_seen
=
TRU
E
)
{
protected
function
getWatchdogMessages
(
array
$conditions
=
array
(),
$
reset
=
FALS
E
)
{
static
$levels
;
if
(
!
module_exists
(
'dblog'
))
{
if
(
!
module_exists
(
'dblog'
)
||
$reset
)
{
$this
->
seen_ids
=
array
();
return
;
}
if
(
!
isset
(
$levels
))
{
...
...
@@ -209,10 +210,10 @@ class XMLSitemapTestHelper extends DrupalWebTestCase {
}
$query
->
condition
(
$field
,
$value
);
}
if
(
$exclude_seen
&&
$this
->
seen_ids
)
{
if
(
$this
->
seen_ids
)
{
$query
->
condition
(
'wid'
,
$this
->
seen_ids
,
'NOT IN'
);
}
$query
->
orderBy
(
'timestamp'
,
'ASC'
);
$query
->
orderBy
(
'timestamp'
);
$messages
=
$query
->
execute
()
->
fetchAllAssoc
(
'wid'
);
foreach
(
$messages
as
&
$message
)
{
...
...
@@ -239,11 +240,11 @@ class XMLSitemapTestHelper extends DrupalWebTestCase {
* Check that there were no watchdog errors or worse.
*/
protected
function
assertNoWatchdogErrors
()
{
$messages
=
$this
->
getWatchdogMessages
(
array
(),
FALSE
);
$messages
=
$this
->
getWatchdogMessages
();
$verbose
=
array
();
foreach
(
$messages
as
$message
)
{
if
(
in_array
(
$message
->
severity
,
array
(
WATCHDOG_EMERG
,
WATCHDOG_ALERT
,
WATCHDOG_CRITICAL
,
WATCHDOG_ERROR
,
WATCHDOG_WARNING
))
&&
!
in_array
(
$message
->
wid
,
$this
->
seen_ids
)
)
{
if
(
in_array
(
$message
->
severity
,
array
(
WATCHDOG_EMERG
,
WATCHDOG_ALERT
,
WATCHDOG_CRITICAL
,
WATCHDOG_ERROR
,
WATCHDOG_WARNING
)))
{
$this
->
fail
(
$message
->
text
);
}
$verbose
[]
=
$message
->
text
;
...
...
@@ -527,9 +528,10 @@ class XMLSitemapUnitTest extends XMLSitemapTestHelper {
*/
function
testUpdateLinks
()
{
// Add our testing data.
$link1
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group1'
));
$link2
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group1'
));
$link3
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group2'
));
$links
=
array
();
$links
[
1
]
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group1'
));
$links
[
2
]
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group1'
));
$links
[
3
]
=
$this
->
addSitemapLink
(
array
(
'subtype'
=>
'group2'
));
variable_set
(
'xmlsitemap_regenerate_needed'
,
FALSE
);
// id | type | subtype | language | access | status | priority
// 1 | testing | group1 | '' | 1 | 1 | 0.5
...
...
@@ -706,7 +708,7 @@ class XMLSitemapRobotsTxtIntegrationTest extends XMLSitemapTestHelper {
}
function
setUp
()
{
parent
::
setUp
(
'xmlsitemap'
,
'robotstxt'
);
parent
::
setUp
(
'robotstxt'
);
}
function
testRobotsTxt
()
{
...
...
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