Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
300
Merge Requests
300
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
4e25a321
Commit
4e25a321
authored
May 07, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#243967
by justinrandell: first very basic test for the registry's file parsing.
parent
e4e2205b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
includes/registry.test
includes/registry.test
+56
-0
No files found.
includes/registry.test
0 → 100644
View file @
4e25a321
<?php
class
RegistryParseFileTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
*/
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'Registry parse file test'
),
'description'
=>
t
(
'Parse a simple file and check that its resources are saved to the database.'
),
'group'
=>
t
(
'System'
)
);
}
/**
* Implementation of setUp().
*/
function
setUp
()
{
$this
->
fileName
=
'registry_test_'
.
md5
(
rand
());
$this
->
functionName
=
'registry_test_function'
.
md5
(
rand
());
$this
->
className
=
'registry_test_class'
.
md5
(
rand
());
$this
->
interfaceName
=
'registry_test_interface'
.
md5
(
rand
());
parent
::
setUp
();
}
/**
* testRegistryParseFile
*/
function
testRegistryParseFile
()
{
_registry_parse_file
(
$this
->
fileName
,
$this
->
getFileContents
());
foreach
(
array
(
'functionName'
,
'className'
,
'interfaceName'
)
as
$resource
)
{
$foundName
=
db_result
(
db_query
(
"SELECT name FROM
{
registry
}
WHERE name = '%s'"
,
$this
->
$resource
));
$this
->
assertTrue
(
$this
->
$resource
==
$foundName
,
t
(
'Resource "@resource" found.'
,
array
(
'@resource'
=>
$this
->
$resource
)));
}
}
/**
* getFileContents
*/
function
getFileContents
()
{
$file_contents
=
<<<CONTENTS
<?php
function {$this->functionName}() {}
class {$this->className} {}
interface {$this->interfaceName} {}
CONTENTS;
return
$file_contents
;
}
}
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