/** * testSessionWithDirectoryQueryCreatesExpectedNullClassInstances * * @return void * @covers \stdClass * @group reflection * @group reflection::integration * @group integrationtest */ public function testSessionWithDirectoryQueryCreatesExpectedNullClassInstances() { $path = dirname($this->getPathnameForClass('ClassWithNullAndPreParsedInterface')); $session = new ReflectionSession(); $session->addClassFactory(new NullReflectionClassFactory()); $query = $session->createDirectoryQuery(); $class = $query->find($path)->current(); $interfaces = $class->getInterfaces(); $this->assertFalse($interfaces[0]->isUserDefined()); }
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @category PHP * @package pdepend\reflection\examples * @author Manuel Pichler <*****@*****.**> * @copyright 2009-2010 Manuel Pichler. All rights reserved. * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id$ * @link http://pdepend.org/ */ use pdepend\reflection\Autoloader; use pdepend\reflection\ReflectionSession; if (count($argv) < 2) { echo 'Usage parse_directory.php <directory>', PHP_EOL; exit(23); } if (is_dir($argv[1]) === false) { echo 'No valid directory given: ', $argv[1], PHP_EOL; exit(23); } include_once __DIR__ . '/../../source/pdepend/reflection/Autoloader.php'; spl_autoload_register(array(new Autoloader(), 'autoload')); $session = new ReflectionSession(); $query = $session->createDirectoryQuery(); foreach ($query->find($argv[1]) as $class) { echo '- ', $class->getName(), PHP_EOL, ' ', $class->getFileName(), PHP_EOL; }
/** * testDirectoryQueryResolvesReferenceToParentClass * * @return void * @covers \stdClass * @group reflection * @group reflection::regression * @group regressiontest */ public function testDirectoryQueryResolvesReferenceToParentClass() { $path = dirname($this->getPathnameForClass('Bug006_2')); $session = new ReflectionSession(); $query = $session->createDirectoryQuery(); foreach ($query->find($path) as $class) { if ($class->getName() === 'Bug006_2') { $this->assertType('\\ReflectionClass', $class->getParentClass()); } } }