/**
  * Enables annotation support in a script file.
  */
 public static function enable()
 {
     // make sure that annotations are not replaced twice at the same time
     if (!self::$enabled) {
         self::$enabled = true;
         $support = new LimeAnnotationSupport(self::getScriptPath());
         $support->execute();
         exit;
     }
 }
示例#2
0
<?php

/*
 * This file is part of the Lime framework.
 *
 * (c) Fabien Potencier <*****@*****.**>
 * (c) Bernhard Schussek <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
require_once dirname(__FILE__) . '/setup.php';
LimeAnnotationSupport::enable();
$t = new LimeTest();
// @Test
$foobar = new NonExistingClass();
示例#3
0
 /**
  * Returns the file path of the executed test script
  *
  * @return string  The file path
  */
 protected static function getScriptPath()
 {
     if (is_null(self::$scriptPath)) {
         $traces = debug_backtrace();
         self::$scriptPath = $traces[count($traces) - 1]['file'];
     }
     if (!is_file(self::$scriptPath)) {
         throw new RuntimeException('The script path is not valid: ' . self::$scriptPath);
     }
     return self::$scriptPath;
 }
示例#4
0
文件: LimeCli.php 项目: b00giZm/lime
 protected function includeTest($__lime_path)
 {
     LimeAnnotationSupport::setScriptPath($__lime_path);
     $lexer = new LimeLexerVariables(array('Test', 'Before', 'After', 'BeforeAll', 'AfterAll'), array('Before'));
     // make global variables _really_ global (in case someone uses "global" statements)
     foreach ($lexer->parse(file_get_contents($__lime_path)) as $__lime_variable) {
         $__lime_variable = substr($__lime_variable, 1);
         // strip '$'
         global ${$__lime_variable};
     }
     return include $__lime_path;
 }