phpDocumentor Gallery
PHPUnit
[ class tree: Gallery ] [ index: Gallery ] [ all elements ]

Class: CodeAuditTestCase

Source Location: /lib/tools/phpunit/CodeAuditTestCase.class

Class CodeAuditTestCase

Class Overview

A framework for scanning all of our source files for specific patterns. Subclasses must override the checkFile() method to implement their own checks.

Located in /lib/tools/phpunit/CodeAuditTestCase.class [line 35]

TestCase
   |
   --GalleryTestCase
      |
      --CodeAuditTestCase

Methods

[ Top ]
Direct descendents
Child Class Description
Php43CompatibilityTest Scan through all of our source code and verify that we're not using anything that is not
CodeAuditTest Scan through all of our source code and verify that we're not doing anything \"bad\".
LocalizationAuditTest Lint check our localizations
TemplateAuditTest Test Template functionality
PhpDocAuditTest Lint check our phpdoc
SvnAuditTest Scan through all of our source code and verify proper subversion properties.

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From GalleryTestCase

GalleryTestCase::$_cleanup

Inherited From GalleryTestCase

GalleryTestCase::GalleryTestCase()
GalleryTestCase::assert()
GalleryTestCase::assertEquals()
GalleryTestCase::assertErrorEquals()
Fail if the provided GalleryStatus object does not contain the given error code.
GalleryTestCase::assertEventFired()
Fail if the provided event name was not fired.
GalleryTestCase::assertEventNotFired()
Fail if the provided event name was fired
GalleryTestCase::DeepCompare()
GalleryTestCase::failWithStatus()
This is deprecated in Gallery 2.3 -- now tests should just return $ret and let the framework generate the right failure message.
GalleryTestCase::getEntityCounter()
Get the entity counter listener which contains the types and number of elements deleted.
GalleryTestCase::setUp()
GalleryTestCase::tearDown()
GalleryTestCase::_array_unshift_key_value()
Utility method to array_unshift a single key => value pair.
GalleryTestCase::_becomeGuestUser()
GalleryTestCase::_createDerivative()
GalleryTestCase::_createLinkedItem()
Create a random link item
GalleryTestCase::_createRandomAlbum()
Create a random album
GalleryTestCase::_createRandomDataItem()
Create a random data item
GalleryTestCase::_createRandomGroup()
Create a random group
GalleryTestCase::_createRandomUser()
Create a random user
GalleryTestCase::_createUser()
GalleryTestCase::_deleteAndVerifyEntity()
GalleryTestCase::_disableUserName()
Convenience method to mark a username as disabled.
GalleryTestCase::_getRootId()
GalleryTestCase::_getUnusedId()
Get an id that is not used for anything.
GalleryTestCase::_initEventListenersForTest()
Disable all but some core event listeners by default.
GalleryTestCase::_markEventListenersForCleanup()
Create a backup of the registered event listeners which will be restored in tearDown.
GalleryTestCase::_markFactoryForCleanup()
Create a backup of the factory data which will be restored in tearDown.
GalleryTestCase::_markFactoryModuleForCleanup()
GalleryTestCase::_markForCleanup()
GalleryTestCase::_markPluginParametersForCleanup()
Store plugin parameters to be restored in tearDown
GalleryTestCase::_markToolkitForCleanup()
GalleryTestCase::_registerEventListener()
Register a The NullEventListener for a test
GalleryTestCase::_registerFactoryImplementationForTest()
Register a factory implementation temporarily for this test.
GalleryTestCase::_registerTestEventListener()
Register and event name and associated listener (deprecated).
GalleryTestCase::_setMarkupType()
Set core parameter for markup type.
GalleryTestCase::_signUrl()
Adds an authToken to the given URL
GalleryTestCase::_unregisterFactoryImplementationForTest()
Unregister a specific factory implementation or all implementations of a spefific type temporarily for this test.
GalleryTestCase::_verifyEntity()
GalleryTestCase::_verifyFields()
GalleryTestCase::_verifyMissing()

[ Top ]
Method Summary
CodeAuditTestCase   CodeAuditTestCase()  
void   checkFile()   Overload this method in subclasses to audit the file.
void   finishScan()   Overload this method in subclasses to run any tasks after the scan is complete.
array   getFunctionCalls()   Extract function calls from a php snippet.
array   getFunctionParameters()   Parse a function call into parameters.
void   halt()   Subclasses can call this to stop scanning.
true   shouldCheckFile()   Overload this method in subclasses. If this method returns true, we'll call checkFile on it.
void   testCodeAudit()  
int   _getNextTokenIndex()   Get the next PHP token omitting whitespace tokens.
void   _scanDir()  
void   _scanNonXmlDir()  
void   _scanXmlDir()  
void   _timeCheck()   Keep this test running.

[ Top ]
Methods
Constructor CodeAuditTestCase  [line 37]

  CodeAuditTestCase CodeAuditTestCase( $methodName  )

Parameters:
   $methodName: 


[ Top ]
checkFile  [line 237]

  void checkFile( $fileName, $buffer  )

Overload this method in subclasses to audit the file.

Parameters:
   $fileName: 
   $buffer: 

API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
finishScan  [line 245]

  void finishScan( bool $halted  )

Overload this method in subclasses to run any tasks after the scan is complete.

Parameters:
bool   $halted:  true if the scan was halted early

API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
getFunctionCalls  [line 279]

  array getFunctionCalls( string $phpCode, mixed $function, [string $fileName = null]  )

Extract function calls from a php snippet.

Parameters:
string   $phpCode:  e.g. '<?php print "meow"; $foo->bar("hello world"); ?>'
mixed   $function:  Function to be searched for, e.g.
  • 'foo' for a global function called foo,
  • array('GalleryCoreApi', 'foo') for static function calls of function foo,
  • array(null, 'foo') for instance method calls (matches any object instance)
string   $fileName:  (optional) Cache tokens between function calls for this file name

API Tags:
Return:  of function calls, e.g. array('$bar->foo("hello world")')


[ Top ]
getFunctionParameters  [line 376]

  array getFunctionParameters( string $functionCall  )

Parse a function call into parameters.

Parameters:
string   $functionCall:  e.g. "$this->foo(array(1, 2), 'moo')"

API Tags:
Return:  the list of parameters, e.g. array("array(1, 2)", "'moo'")


[ Top ]
halt  [line 229]

  void halt( )

Subclasses can call this to stop scanning.



[ Top ]
shouldCheckFile  [line 253]

  true shouldCheckFile( $fileName  )

Overload this method in subclasses. If this method returns true, we'll call checkFile on it.

Parameters:
   $fileName: 

API Tags:
Return:  if we should check this file
Access:  protected


Redefined in descendants as:

[ Top ]
testCodeAudit  [line 44]

  void testCodeAudit( )



Redefined in descendants as:

[ Top ]
_getNextTokenIndex  [line 428]

  int _getNextTokenIndex( &$tokens, int $i, [boolean $previous = false], array $tokens  )

Get the next PHP token omitting whitespace tokens.

Parameters:
array   $tokens: 
int   $i:  the current index in the $tokens array
boolean   $previous:  whether to seek backwards (defaults to forward (false))
   &$tokens: 

API Tags:
Return:  the index of the next token in the request direction, or null


[ Top ]
_scanDir  [line 66]

  void _scanDir( $dirPath  )

Parameters:
   $dirPath: 


[ Top ]
_scanNonXmlDir  [line 155]

  void _scanNonXmlDir( $dirPath  )

Parameters:
   $dirPath: 


[ Top ]
_scanXmlDir  [line 100]

  void _scanXmlDir( $dirPath  )

Parameters:
   $dirPath: 


[ Top ]
_timeCheck  [line 215]

  void _timeCheck( )

Keep this test running.



[ Top ]

Documentation generated on Fri, 08 Oct 2010 04:41:55 -0700 by phpDocumentor 1.3.0RC6