Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phalcon functional coverage REQUEST_TIME #3374

Closed
gimler opened this issue Jul 26, 2016 · 4 comments
Closed

Phalcon functional coverage REQUEST_TIME #3374

gimler opened this issue Jul 26, 2016 · 4 comments

Comments

@gimler
Copy link
Contributor

@gimler gimler commented Jul 26, 2016

I get unit tests with coverage to work. But the functional tests only works without coverage.

If i try phpdbg -qrr bin/codecept run functional --coverage i get the following exception:

[PHPUnit_Framework_Exception]  
  Undefined index: REQUEST_TIME

tests/functional.suite.yml

class_name: FunctionalTester
modules:
    enabled:
        - REST:
            depends: Phalcon
        - \Helper\Functional
        - Phalcon:
            bootstrap: 'app/config/bootstrap.php'
            cleanup: true
            savepoints: true

app/config/bootstrap.php

require_once __DIR__ . '/../../vendor/autoload.php';

use Phalcon\Mvc\Micro;
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\Micro\Collection as MicroCollection;

$di = new FactoryDefault();

$di->set('collection.auth', function () {
    $auth = new MicroCollection();
    $auth->setHandler('Controller\Auth', true);
    $auth->get('/login', 'loginAction');

    return $auth;
});

$app = new Micro($di);
$app->mount($app['collection.auth']);

return $app;
@Naktibalda
Copy link
Member

@Naktibalda Naktibalda commented Jul 26, 2016

Codeception is not setting $_SERVER['REQUEST_TIME'];

Have you got a stacktrace?
If this error is happening in your application code, you should modify it to check if REQUEST_TIME is set.

@gimler
Copy link
Contributor Author

@gimler gimler commented Jul 27, 2016

As you can see it cames after the functional tests

...
loginCept: 
Signature: loginCept
Test: tests/functional/loginCept.php
Scenario --
 I am on page "/login"
...
------------------------------------------------------------


Time: 129 ms, Memory: 14.00MB

OK (2 tests, 11 assertions)

[PHPUnit_Framework_Exception (8)]  
  Undefined index: REQUEST_TIME      


Exception trace:
 () at /code/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:60
 Codeception\Subscriber\ErrorHandler->errorHandler() at /code/vendor/phpunit/php-code-coverage/src/Report/Text.php:132
 SebastianBergmann\CodeCoverage\Report\Text->process() at /code/vendor/codeception/codeception/src/Codeception/Coverage/Subscriber/Printer.php:89
 Codeception\Coverage\Subscriber\Printer->printConsole() at /code/vendor/codeception/codeception/src/Codeception/Coverage/Subscriber/Printer.php:62
 Codeception\Coverage\Subscriber\Printer->printResult() at n/a:n/a
 call_user_func() at /code/vendor/symfony/event-dispatcher/EventDispatcher.php:174
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at /code/vendor/symfony/event-dispatcher/EventDispatcher.php:43
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /code/vendor/codeception/codeception/src/Codeception/Codecept.php:226
 Codeception\Codecept->printResult() at /code/vendor/codeception/codeception/src/Codeception/Command/Run.php:271
 Codeception\Command\Run->execute() at /code/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /code/vendor/symfony/console/Application.php:815
 Symfony\Component\Console\Application->doRunCommand() at /code/vendor/symfony/console/Application.php:186
 Symfony\Component\Console\Application->doRun() at /code/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at /code/vendor/codeception/codeception/src/Codeception/Application.php:103
 Codeception\Application->run() at /code/vendor/codeception/codeception/codecept:33

@gimler
Copy link
Contributor Author

@gimler gimler commented Jul 27, 2016

Codeception PHP Testing Framework v2.2.2
Powered by PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

PHP 7.0.7 (cli) (built: Jun 8 2016 18:19:37) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

@gimler
Copy link
Contributor Author

@gimler gimler commented Jul 27, 2016

the error comes from phpunit vendor/phpunit/php-code-coverage/src/Report/Text.php line 132

gimler pushed a commit to gimler/Codeception that referenced this issue Jul 27, 2016
gimler pushed a commit to gimler/Codeception that referenced this issue Jul 27, 2016
gimler pushed a commit to gimler/Codeception that referenced this issue Jul 27, 2016
Naktibalda added a commit that referenced this issue Jul 28, 2016
fix #3374 missing REQUEST_TIME server variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.