Yii Framework Forum: YiiBase::autoload() fails to include TestCase.php - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

YiiBase::autoload() fails to include TestCase.php When invoked via phpunit-skeleton, Yii's autoload does not conver Rate Topic: -----

#1 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 01 August 2012 - 07:38 PM

I have been using phpunit plus its related software such as code coverage in yii without a problem.

Recently, I installed phpunit pear install phpunit/PHPUnit_SkeletonGenerator since I no longer have access to this as part of phpunit. Here is my challenge...for a simple class.

<?phpclass Calculator
{
    public function add($a, $B)
    {
        return $a + $b;
    }
}

?>


On the command line, if I run the generator on the above class, you can see that it works.


seal@server:~$ phpunit-skelgen --test Calculator
PHPUnit Skeleton Generator 1.1.0 by Sebastian Bergmann.

Wrote skeleton for "CalculatorTest" to "/home/seal/CalculatorTest.php".


Now if I were to run the same class within a yii project.
/www/calculator/protected/tests$ phpunit-skelgen --bootstrap bootstrap.php --test ../models/Post.php
PHPUnit Skeleton Generator 1.1.0 by Sebastian Bergmann.

PHP Warning:  include(PHPUnit_Framework_TestCase.php): failed to open stream: No such file or directory in /home/seal/Library/yii/framework/YiiBase.php on line 423

It appears YiiBase::autoload() cannot find the path "PHPUnit/Framework/TestCase.php

Point to note:
  • I do have phpunit in the include path for both apache and CLI
  • I have also tried to require TestCase directly within the bootstrap.php this works. but then more errors comes up for other files YiiBase::autoload() were unable to find. Also, phpunit have several autoload which makes this approach fruitless.
  • I have tried to register the autoload directly, but tis conflicts with yii's autoload.

I welcome any help or suggestions or even questions I can get

Thanks

Attached File(s)


Sylvester La-Tunje

Posted Image
0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 534
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 02 August 2012 - 01:50 PM

Which Yii version are you using? I fixed a related thing in 1.1.11
0

#3 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 02 August 2012 - 02:01 PM

Thanks for your time CeBe.

I am using the latest commit via git. (Yii 1.1.11)
Sylvester La-Tunje

Posted Image
0

#4 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 02 August 2012 - 02:05 PM

Looking at the source for phpunit autoload, it appears the author uses independent autoload per tool.

And skeleton is not even part of the main Autoload.php
Sylvester La-Tunje

Posted Image
0

#5 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 534
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 02 August 2012 - 02:23 PM

View PostSeal, on 02 August 2012 - 02:05 PM, said:

Looking at the source for phpunit autoload, it appears the author uses independent autoload per tool.

And skeleton is not even part of the main Autoload.php


Can you open a ticket on github? Will then check whether its a yii or phpunit problem.
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 03 August 2012 - 02:37 AM

Issue on github - https://github.com/y...yii/issues/1110
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users