Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
justinfreeman (Agileware)
Core
Commits
5760d4c9
Commit
5760d4c9
authored
11 years ago
by
colemanw
Browse files
Options
Downloads
Patches
Plain Diff
This file appears to be unused
parent
43849b44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/phpunit/CiviTest/CiviTestCase.php
+0
-175
0 additions, 175 deletions
tests/phpunit/CiviTest/CiviTestCase.php
with
0 additions
and
175 deletions
tests/phpunit/CiviTest/CiviTestCase.php
deleted
100644 → 0
+
0
−
175
View file @
43849b44
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
class
CiviTestCase
extends
PHPUnit_Framework_Testcase
{
function
__construct
()
{
parent
::
__construct
();
require_once
'CRM/Core/Config.php'
;
$config
=
CRM_Core_Config
::
singleton
();
}
function
civiGet
(
$path
,
$params
,
$abort
=
FALSE
)
{
$url
=
CRM_Utils_System
::
url
(
$path
,
$params
,
TRUE
,
NULL
,
FALSE
);
return
$this
->
civiGetURL
(
$url
,
$abort
);
}
function
civiGetURL
(
$url
,
$abort
=
FALSE
)
{
$html
=
$this
->
_browser
->
get
(
$url
);
if
(
$this
->
drupalCheckAuth
(
TRUE
))
{
$html
.
=
$this
->
drupalCheckAuth
();
}
$this
->
_content
=
$this
->
_browser
->
getContent
();
if
(
$abort
)
{
echo
$html
;
exit
();
}
return
$html
;
}
function
getUrlsByLabel
(
$label
,
$fuzzy
=
FALSE
)
{
if
(
!
$fuzzy
)
{
return
$this
->
_browser
->
_page
->
getUrlsByLabel
(
$label
);
}
$matches
=
array
();
foreach
(
$this
->
_browser
->
_page
->
_links
as
$link
)
{
$text
=
$link
->
getText
();
if
(
$text
==
$label
||
strpos
(
$text
,
$label
)
!==
FALSE
)
{
$matches
[]
=
$this
->
_browser
->
_page
->
_getUrlFromLink
(
$link
);
}
}
return
$matches
;
}
function
isCiviURL
(
$url
,
$ignoreVariations
=
TRUE
)
{
static
$config
=
NULL
;
if
(
!
$config
)
{
$config
=
CRM_Core_Config
::
singleton
();
}
if
(
strpos
(
$url
,
$config
->
userFrameworkBaseURL
.
'civicrm/'
)
===
FALSE
)
{
return
FALSE
;
}
// ignore all urls with snippet, force, crmSID
if
(
$ignoreVariations
&&
(
strpos
(
$url
,
'snippet='
)
||
strpos
(
$url
,
'force='
)
||
strpos
(
$url
,
'crmSID='
)
)
)
{
return
FALSE
;
}
return
TRUE
;
}
function
getUrlsByToken
(
$token
,
$path
=
NULL
)
{
$matches
=
array
();
foreach
(
$this
->
_browser
->
_page
->
_links
as
$link
)
{
$text
=
$link
->
getText
();
$url
=
$this
->
_browser
->
_page
->
_getUrlFromLink
(
$link
)
->
asString
();
if
(
$this
->
isCiviURL
(
$url
)
&&
(
strpos
(
$url
,
$token
)
!==
FALSE
)
)
{
if
(
!
$path
||
strpos
(
$url
,
$path
)
!==
FALSE
)
{
$matches
[
$text
]
=
$url
;
}
}
}
return
$matches
;
}
function
clickLink
(
$label
,
$index
=
0
,
$fuzzy
=
FALSE
)
{
if
(
!
$fuzzy
)
{
return
parent
::
clickLink
(
$label
,
$index
);
}
$url_before
=
str_replace
(
'%'
,
'%%'
,
$this
->
getUrl
());
$urls
=
$this
->
getUrlsByLabel
(
$label
,
TRUE
);
if
(
count
(
$urls
)
<
$index
+
1
)
{
$url_target
=
'URL NOT FOUND!'
;
}
else
{
$url_target
=
str_replace
(
'%'
,
'%%'
,
$urls
[
$index
]
->
asString
());
}
$this
->
_browser
->
_load
(
$urls
[
$index
],
new
SimpleGetEncoding
());
$ret
=
$this
->
_failOnError
(
$this
->
_browser
->
getContent
());
$this
->
assertTrue
(
$ret
,
' [browser] clicked link '
.
t
(
$label
)
.
" (
$url_target
) from
$url_before
"
);
return
$ret
;
}
function
allPermissions
()
{
return
array
(
1
=>
'add contacts'
,
2
=>
'view all contacts'
,
3
=>
'edit all contacts'
,
4
=>
'import contacts'
,
5
=>
'edit groups'
,
6
=>
'administer CiviCRM'
,
7
=>
'access uploaded files'
,
8
=>
'profile listings and forms'
,
9
=>
'access all custom data'
,
10
=>
'view all activities'
,
11
=>
'access CiviCRM'
,
12
=>
'access Contact Dashboard'
,
);
}
function
errorPage
(
&
$ret
,
&
$url
)
{
// check if there is a civicrm error or warning message on the page
// at a later stage, we should also check for CMS based errors
$this
->
assertTrue
(
$ret
,
ts
(
' [browser] GET %1"'
,
array
(
'%1'
=>
$url
)));
$this
->
assertNoText
(
'Sorry. A non-recoverable error has occurred'
,
'[browser] fatal error page?'
);
$this
->
assertNoText
(
'The requested page could not be found'
,
'[browser] page not found?'
);
$this
->
assertNoText
(
'You are not authorized to access this page'
,
'[browser] permission denied?'
);
return
;
}
}
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