I was going to say:
I'm curious, what happens if you run it with the composer installed
> phpunit? Your command will be something like
> `vendor/bin/phpunit tests/TestCase/View/Helper/`.
But then I noticed your path: `E:\web\cake3-rc2\vendor\`. You should never
add/edit/remove any file maintained by a package manager (composer in this
case). Move these into the respective folders in src and you should be good
to go.
On Sunday, February 15, 2015 at 8:29:09 PM UTC-5, Lorne Dudley wrote:
>
> Hello Andrew !
>
> OK, I tried this.
> E:\web\cake3-rc2>php composer.phar dump-autoload
> Generating autoload files
>
> Then
> E:\web\cake3-rc2>phpunit
> vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php
> PHPUnit 4.5.0 by Sebastian Bergmann and contributors.
>
> Configuration read from E:\web\cake3-rc2\phpunit.xml.dist
>
>
> Fatal error: Class 'App\View\Helper\ProgressHelper' not found in
> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
>
> on line 15
>
> Call Stack:
> 0.0300 441920 1. {main}() C:\bin\phpunit.phar:0
> 0.0300 669080 2. PHPUnit_TextUI_Command::main()
> C:\bin\phpunit.phar:722
> 0.0300 673024 3. PHPUnit_TextUI_Command->run()
> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:104
> 0.2120 3838104 4. PHPUnit_TextUI_TestRunner->doRun()
> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152
> 0.2320 4158704 5. PHPUnit_Framework_TestSuite->run()
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398
> 0.2420 4169832 6. PHPUnit_Framework_TestCase->run()
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716
> 0.2420 4170576 7. PHPUnit_Framework_TestResult->run()
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693
> 0.2520 4226312 8. PHPUnit_Framework_TestCase->runBare()
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609
> 0.2620 4316576 9.
> App\Test\TestCase\View\Helper\ProgressHelperTest->setUp()
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733
>
> Here are my file contents and their locations.
>
> E:\web\cake3-rc2\phpunit.xml.dist
> =================================
> <?xml version="1.0" encoding="UTF-8"?>
> <phpunit
> colors="true"
> processIsolation="false"
> stopOnFailure="false"
> syntaxCheck="false"
> bootstrap="./tests/bootstrap.php"
> >
> <php>
> <ini name="memory_limit" value="-1"/>
> <ini name="apc.enable_cli" value="1"/>
> </php>
>
> <!-- Add any additional test suites you want to run here -->
> <testsuites>
> <testsuite name="App Test Suite">
> <directory>./tests/TestCase</directory>
> </testsuite>
> <!-- Add plugin test suites here. -->
> </testsuites>
>
> <!-- Setup a listener for fixtures -->
> <listeners>
> <listener
> class="\Cake\TestSuite\Fixture\FixtureInjector"
>
> file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
> <arguments>
> <object class="\Cake\TestSuite\Fixture\FixtureManager" />
> </arguments>
> </listener>
> </listeners>
>
> </phpunit>
>
> E:\web\cake3-rc2\vendor\cakephp\bake\src\View\Helper\ProgressHelper.php
> =======================================================================
> <?php
> namespace App\View\Helper;
>
> class ProgressHelper extends AppHelper
> {
> public function bar($value)
> {
> $width = round($value / 100, 2) * 100;
> return sprintf(
> '<div class="progress-container">
> <div class="progress-bar" style="width: %s%%"></div>
> </div>', $width);
> }
> }
>
>
> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
>
> ======================================================================================
> <?php
> namespace App\Test\TestCase\View\Helper;
>
> use App\View\Helper\ProgressHelper;
> use Cake\TestSuite\TestCase;
> use Cake\View\View;
>
> class ProgressHelperTest extends TestCase
> {
>
> public function setUp()
> {
> parent::setUp();
> $View = new View();
> $this->Progress = new ProgressHelper($View);
> }
>
> public function testBar()
> {
> $result = $this->Progress->bar(90);
> $this->assertContains('width: 90%', $result);
> $this->assertContains('progress-bar', $result);
>
> $result = $this->Progress->bar(33.3333333);
> $this->assertContains('width: 33%', $result);
> }
>
> }
>
>
> ======================================================================================
>
> I am not at all confident that I have things placed in the correct
> directories.
> The documentation (PDF version, starting at page 559) does not clearly
> indicate where these items should be placed.
> I am guessing that the reference to the directory tests is on the vendor
> side.
>
> My long term goal is to learn enough about "Testing" so that I can develop
> a test for a change
> made to /vendor/cakephp/bake/src/Template/Bake/Element/form.ctp
>
> Any help or assistance for this new member of the cakephp community would
> be greatly appreciated.
>
> On Saturday, February 14, 2015 at 4:23:42 PM UTC-5, Andrew Lechowicz wrote:
>>
>> When something isn't loading the correct file, it smells like a composer
>> autoload issue or a namespace issue. Try running `composer dump-autoload`.
>> If that doesn't work try looking at your `use` blocks to see if you might
>> be missing something.
>>
>> On Friday, February 13, 2015 at 12:00:11 AM UTC-5, Lorne Dudley wrote:
>>>
>>> OK, I have made a little progress in trying to figure out what is
>>> wrong. My conclusion is that there are some steps missing in the
>>> documentation.
>>> I hope that perhaps one of the core developers might comment as to what
>>> might be wrong.
>>>
>>> I was able to make the "Fatal error: Class
>>> 'App\View\Helper\ProgressHelper' not found" error to go away by placing
>>> ProgressHelper.php in the same directory as ProgressHelperTest.php.
>>> However I still get a failure further on -- "Fatal error: Class
>>> 'Cake\TestSuite\TestCase' not found".
>>>
>>> It appears that all searches for dependent components take place in the
>>> same directory as ProgressHelperTest.php at the moment.
>>>
>>> So ... how do I fix this so that searches for dependent components are
>>> resolved properly ??? What is missing in the documentation ?
>>>
>>> Below are my two latest attempts to get this to execute properly.
>>>
>>> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper>phpunit
>>> ProgressHelperTest.php
>>>
>>> Fatal error: Class 'Cake\TestSuite\TestCase' not found in
>>> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
>>>
>>> on line 9
>>>
>>> Call Stack:
>>> 0.0340 441904 1. {main}() C:\bin\phpunit.phar:0
>>> 0.0360 669064 2. PHPUnit_TextUI_Command::main()
>>> C:\bin\phpunit.phar:722
>>> 0.0360 673008 3. PHPUnit_TextUI_Command->run()
>>> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:104
>>> 0.0430 907096 4. PHPUnit_Runner_BaseTestRunner->getTest()
>>> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:126
>>> 0.0430 907120 5.
>>> PHPUnit_Runner_BaseTestRunner->loadSuiteClass()
>>> phar://C:/bin/phpunit.phar/phpunit/Runner/BaseTestRunner.php:70
>>> 0.0440 923936 6.
>>> PHPUnit_Runner_StandardTestSuiteLoader->load()
>>> phar://C:/bin/phpunit.phar/phpunit/Runner/BaseTestRunner.php:125
>>> 0.0450 948688 7. PHPUnit_Util_Fileloader::checkAndLoad()
>>> phar://C:/bin/phpunit.phar/phpunit/Runner/StandardTestSuiteLoader.php:43
>>> 0.0470 948848 8. PHPUnit_Util_Fileloader::load()
>>> phar://C:/bin/phpunit.phar/phpunit/Util/Fileloader.php:42
>>> 0.0470 954616 9.
>>> include_once('E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php')
>>>
>>> phar://C:/bin/phpunit.phar/phpunit/Util/Fileloader.php:58
>>>
>>>
>>> E:\web\cake3-rc2\vendor\cakephp\bake>phpunit
>>> tests/TestCase/View/Helper/ProgressHelperTest.php
>>> PHPUnit 4.5.0 by Sebastian Bergmann and contributors.
>>>
>>> Configuration read from
>>> E:\web\cake3-rc2\vendor\cakephp\bake\phpunit.xml.dist
>>>
>>>
>>> Fatal error: Class 'App\View\Helper\ProgressHelper' not found in
>>> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
>>>
>>> on line 15
>>>
>>> Call Stack:
>>> 0.0280 441920 1. {main}() C:\bin\phpunit.phar:0
>>> 0.0310 669088 2. PHPUnit_TextUI_Command::main()
>>> C:\bin\phpunit.phar:722
>>> 0.0310 673032 3. PHPUnit_TextUI_Command->run()
>>> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:104
>>> 0.1030 2762848 4. PHPUnit_TextUI_TestRunner->doRun()
>>> phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152
>>> 0.1180 3083496 5. PHPUnit_Framework_TestSuite->run()
>>> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398
>>> 0.1250 3094624 6. PHPUnit_Framework_TestCase->run()
>>> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716
>>> 0.1250 3095368 7. PHPUnit_Framework_TestResult->run()
>>> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693
>>> 0.1320 3150720 8. PHPUnit_Framework_TestCase->runBare()
>>> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609
>>> 0.1360 3240640 9.
>>> App\Test\TestCase\View\Helper\ProgressHelperTest->setUp()
>>> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733
>>>
>>>
>>>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.