Visualphpunit\Core\Suite::store PHP Method

store() public static method

Store a test suite result
public static store ( Doctrine\DBAL\Connection $connection, mixed[] $result ) : boolean
$connection Doctrine\DBAL\Connection
$result mixed[]
return boolean
    public static function store(Connection $connection, $result)
    {
        $sql = "INSERT INTO suites (suite, executed) VALUES (?, ?);";
        $date = new DateTime();
        $stmt = $connection->prepare($sql);
        $stmt->bindValue(1, json_encode($result));
        $stmt->bindValue(2, $date->format('Y-m-d H:i:s'));
        return $stmt->execute();
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Run the selected test files
  *
  * Run the selected test with phpunit
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Silex\Application $app
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(Request $request, Application $app)
 {
     Suite::createTable($app['db']);
     Test::createTable($app['db']);
     $data = json_decode($request->getContent(), true);
     if (count($data['files'])) {
         $parser = new Parser();
         $result = $parser->run($data['files']);
         if ($data['config']['snapshot']) {
             Suite::store($app['db'], $result);
         }
         Test::store($app['db'], $result);
         return $this->ok([$result]);
     }
     return $this->ok(['nofiles']);
 }
All Usage Examples Of Visualphpunit\Core\Suite::store