Re: cakePHP 3.0.0-RC2 documentation, Testing
So your not trying to build an app on top of CakePHP but rather I think my rule still stands here. In fact I believe that's the problem. Instead of cloning the project you created a new one which is meant to *use *the CakePHP core files and I believe tests will be set up accordingly. I think your best bet is to fork https://github.com/cakephp/bake and apply your tests and changes there. The bonus with this method is it's easy to create PR's back to the core. On Monday, February 16, 2015 at 3:51:51 PM UTC-5, Lorne Dudley wrote: Hello Andrew ! (and anyone else who wishes to contribute) Reference your comment on You should never add/edit/remove any file maintained by a package manager, I think that my case is an exception. With the assistance of another developer I have developed a fix for a cake bake issue. My challenge is to develop a test case for the change. See https://github.com/cakephp/bake/issues/35 . I have a change to /vendor/cakephp/bake/src/Template/Bake/Element/form.ctp which solves the problem. Following your suggestions I tried a few variations. First, I used the imbedded phpunit in cakephp on my existing structure on the /vendor side. Then on the corresponding structure under /tests. In both cases the results are the same. I then tried the C:/bin/phpunit. Same results. (Conclusion, it does not matter which phpunit I use.) I noticed vendor/cakephp/bake/tests/TestCase/View/BakeViewTest.php which is part of the composer delivered cakephp system. I tried phpunit on that file and everything seems to work correctly. Conclusion: There must be some setup detail missing in the documented example in the Testing section ? Do you have any ideas following this additional information ? I am wondering if I need to understand what is going on with E:\web\cake3-rc2\phpunit.xml.dist . (See previous reply for content.) Regards Lorne My results are shown below. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit --version PHPUnit 4.5.0 by Sebastian Bergmann and contributors. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/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. 121872 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474688 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478624 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.20003402520 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.22003723104 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.23003734232 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.23003734976 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.26003790704 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.29003880808 9. App\Test\TestCase\View\Helper\ProgressHelperTest-setUp() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733 -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit 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\AppHelper' not found in E:\web\cake3-rc2\src\View\Helper\ProgressHelper.php on line 5 Call Stack: 0. 121856 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474648 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478584 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.12003402512 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.14003723088 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.14003734216 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.14003734960 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.16003790688 8.
Re: cakePHP 3.0.0-RC2 documentation, Testing
Hello Andrew True, my long term goal is to submit my changes to github.But first, I have to learn how to set up a test.So I am trying to follow the simple example in the Testing chapter at this point. I am new to the world of object-oriented programming, coming from a procedure oriented background. So my immediate goal is to get the example in the document running. Once I understand things at that level I will attempt to write the test case for my proposed change. Regards Lorne On Monday, February 16, 2015 at 5:04:33 PM UTC-5, Andrew Lechowicz wrote: So your not trying to build an app on top of CakePHP but rather I think my rule still stands here. In fact I believe that's the problem. Instead of cloning the project you created a new one which is meant to *use *the CakePHP core files and I believe tests will be set up accordingly. I think your best bet is to fork https://github.com/cakephp/bake and apply your tests and changes there. The bonus with this method is it's easy to create PR's back to the core. On Monday, February 16, 2015 at 3:51:51 PM UTC-5, Lorne Dudley wrote: Hello Andrew ! (and anyone else who wishes to contribute) Reference your comment on You should never add/edit/remove any file maintained by a package manager, I think that my case is an exception. With the assistance of another developer I have developed a fix for a cake bake issue. My challenge is to develop a test case for the change. See https://github.com/cakephp/bake/issues/35 . I have a change to /vendor/cakephp/bake/src/Template/Bake/Element/form.ctp which solves the problem. Following your suggestions I tried a few variations. First, I used the imbedded phpunit in cakephp on my existing structure on the /vendor side. Then on the corresponding structure under /tests. In both cases the results are the same. I then tried the C:/bin/phpunit. Same results. (Conclusion, it does not matter which phpunit I use.) I noticed vendor/cakephp/bake/tests/TestCase/View/BakeViewTest.php which is part of the composer delivered cakephp system. I tried phpunit on that file and everything seems to work correctly. Conclusion: There must be some setup detail missing in the documented example in the Testing section ? Do you have any ideas following this additional information ? I am wondering if I need to understand what is going on with E:\web\cake3-rc2\phpunit.xml.dist . (See previous reply for content.) Regards Lorne My results are shown below. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit --version PHPUnit 4.5.0 by Sebastian Bergmann and contributors. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/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. 121872 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474688 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478624 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.20003402520 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.22003723104 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.23003734232 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.23003734976 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.26003790704 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.29003880808 9. App\Test\TestCase\View\Helper\ProgressHelperTest-setUp() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733 -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit 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\AppHelper' not found in E:\web\cake3-rc2\src\View\Helper\ProgressHelper.php on line 5 Call Stack: 0. 121856 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474648 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478584 3. PHPUnit_TextUI_Command-run()
Re: cakePHP 3.0.0-RC2 documentation, Testing
OK, I have moved ahead on the /vendor side thanks to some suggestions from Mark Story. create /web/cake3-rc2-v3 directory git clone git://github.com/cakephp/bake.git cd bake copy composer.phar to /web/cake3-rc2-v3/bake directory php composer.phar install Now, the following works. E:\web\cake3-rc2-v3\bake vendor\bin\phpunit tests/TestCase/Shell/Task/BakeTemplateTaskTest.php PHPUnit 4.5.0 by Sebastian Bergmann and contributors. Configuration read from E:\web\cake3-rc2-v3\bake\phpunit.xml.dist ... Time: 932 ms, Memory: 4.75Mb OK (3 tests, 3 assertions) Note for Windows users. The back slash, \ , must be used to execute phpunit. I am still stuck on getting the simple example in the Testing chapter of the documentation to run. Any clues anyone ??? On Monday, February 16, 2015 at 6:30:46 PM UTC-5, Lorne Dudley wrote: Hello Andrew True, my long term goal is to submit my changes to github.But first, I have to learn how to set up a test.So I am trying to follow the simple example in the Testing chapter at this point. I am new to the world of object-oriented programming, coming from a procedure oriented background. So my immediate goal is to get the example in the document running. Once I understand things at that level I will attempt to write the test case for my proposed change. Regards Lorne On Monday, February 16, 2015 at 5:04:33 PM UTC-5, Andrew Lechowicz wrote: So your not trying to build an app on top of CakePHP but rather I think my rule still stands here. In fact I believe that's the problem. Instead of cloning the project you created a new one which is meant to *use *the CakePHP core files and I believe tests will be set up accordingly. I think your best bet is to fork https://github.com/cakephp/bake and apply your tests and changes there. The bonus with this method is it's easy to create PR's back to the core. On Monday, February 16, 2015 at 3:51:51 PM UTC-5, Lorne Dudley wrote: Hello Andrew ! (and anyone else who wishes to contribute) Reference your comment on You should never add/edit/remove any file maintained by a package manager, I think that my case is an exception. With the assistance of another developer I have developed a fix for a cake bake issue. My challenge is to develop a test case for the change. See https://github.com/cakephp/bake/issues/35 . I have a change to /vendor/cakephp/bake/src/Template/Bake/Element/form.ctp which solves the problem. Following your suggestions I tried a few variations. First, I used the imbedded phpunit in cakephp on my existing structure on the /vendor side. Then on the corresponding structure under /tests. In both cases the results are the same. I then tried the C:/bin/phpunit. Same results. (Conclusion, it does not matter which phpunit I use.) I noticed vendor/cakephp/bake/tests/TestCase/View/BakeViewTest.php which is part of the composer delivered cakephp system. I tried phpunit on that file and everything seems to work correctly. Conclusion: There must be some setup detail missing in the documented example in the Testing section ? Do you have any ideas following this additional information ? I am wondering if I need to understand what is going on with E:\web\cake3-rc2\phpunit.xml.dist . (See previous reply for content.) Regards Lorne My results are shown below. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit --version PHPUnit 4.5.0 by Sebastian Bergmann and contributors. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/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. 121872 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474688 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478624 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.20003402520 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.22003723104 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.23003734232 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.23003734976 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.26003790704 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609
Re: cakePHP 3.0.0-RC2 documentation, Testing
Hello Andrew ! (and anyone else who wishes to contribute) Reference your comment on You should never add/edit/remove any file maintained by a package manager, I think that my case is an exception. With the assistance of another developer I have developed a fix for a cake bake issue. My challenge is to develop a test case for the change. See https://github.com/cakephp/bake/issues/35 . I have a change to /vendor/cakephp/bake/src/Template/Bake/Element/form.ctp which solves the problem. Following your suggestions I tried a few variations. First, I used the imbedded phpunit in cakephp on my existing structure on the /vendor side. Then on the corresponding structure under /tests. In both cases the results are the same. I then tried the C:/bin/phpunit. Same results. (Conclusion, it does not matter which phpunit I use.) I noticed vendor/cakephp/bake/tests/TestCase/View/BakeViewTest.php which is part of the composer delivered cakephp system. I tried phpunit on that file and everything seems to work correctly. Conclusion: There must be some setup detail missing in the documented example in the Testing section ? Do you have any ideas following this additional information ? I am wondering if I need to understand what is going on with E:\web\cake3-rc2\phpunit.xml.dist . (See previous reply for content.) Regards Lorne My results are shown below. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit --version PHPUnit 4.5.0 by Sebastian Bergmann and contributors. -- E:\web\cake3-rc2php vendor/phpunit/phpunit/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. 121872 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474688 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478624 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.20003402520 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.22003723104 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.23003734232 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.23003734976 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.26003790704 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.29003880808 9. App\Test\TestCase\View\Helper\ProgressHelperTest-setUp() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733 -- E:\web\cake3-rc2php vendor/phpunit/phpunit/phpunit 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\AppHelper' not found in E:\web\cake3-rc2\src\View\Helper\ProgressHelper.php on line 5 Call Stack: 0. 121856 1. {main}() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:0 0.0100 474648 2. PHPUnit_TextUI_Command::main() E:\web\cake3-rc2\vendor\phpunit\phpunit\phpunit:36 0.0100 478584 3. PHPUnit_TextUI_Command-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:104 0.12003402512 4. PHPUnit_TextUI_TestRunner-doRun() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\Command.php:152 0.14003723088 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.14003734216 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.14003734960 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.16003790688 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.16003880760 9. App\Test\TestCase\View\Helper\ProgressHelperTest-setUp() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733 0.18004539216 10. spl_autoload_call() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:15 0.18004539256 11. Composer\Autoload\ClassLoader-loadClass() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:15 0.18004539352 12. Composer\Autoload\includeFile() E:\web\cake3-rc2\vendor\composer\ClassLoader.php:301
Re: cakePHP 3.0.0-RC2 documentation, Testing
Hello Andrew ! OK, I tried this. E:\web\cake3-rc2php composer.phar dump-autoload Generating autoload files Then E:\web\cake3-rc2phpunit 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.21203838104 4. PHPUnit_TextUI_TestRunner-doRun() phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152 0.23204158704 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.24204169832 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.24204170576 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.25204226312 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.26204316576 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.333); $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
Re: cakePHP 3.0.0-RC2 documentation, Testing
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-rc2php composer.phar dump-autoload Generating autoload files Then E:\web\cake3-rc2phpunit 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.21203838104 4. PHPUnit_TextUI_TestRunner-doRun() phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152 0.23204158704 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.24204169832 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.24204170576 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.25204226312 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.26204316576 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.333); $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
Re: cakePHP 3.0.0-RC2 documentation, Testing
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\Helperphpunit 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\bakephpunit 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.10302762848 4. PHPUnit_TextUI_TestRunner-doRun() phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152 0.11803083496 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.12503094624 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.12503095368 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.13203150720 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.13603240640 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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: cakePHP 3.0.0-RC2 documentation, Testing
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\Helperphpunit 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\bakephpunit 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.10302762848 4. PHPUnit_TextUI_TestRunner-doRun() phar://C:/bin/phpunit.phar/phpunit/TextUI/Command.php:152 0.11803083496 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.12503094624 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.12503095368 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.13203150720 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.13603240640 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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: cakePHP 3.0.0-RC2 documentation, Testing
This is line 15 in ProgressHelperTest.php, within function setUp() $this-Progress = new ProgressHelper($View); On Wednesday, February 11, 2015 at 9:06:29 PM UTC-5, Lorne Dudley wrote: Testing (page 559 in the pdf version) I am attempting to follow the instructions in the 3.0.0-RC2 document, current as of today. I believe I have followed all of the instructions. This is my setup. (cakePHP 3.0.0-RC2, updated as of today) E:/web/cake3-rc2/vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php E:/web/cake3-rc2/vendor/cakephp/bake/src/View/Helper/ProgressHelper.php E:\web\cake3-rc2\vendor\cakephp\bake phpunit E:/web/cake3-rc2/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\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. 120448 1. {main}() C:\xampp2\php\phpunit:0 0.0156 355992 2. PHPUnit_TextUI_Command::main() C:\xampp2\php\phpunit:46 0.0156 359392 3. PHPUnit_TextUI_Command-run() C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:129 0.09362429736 4. PHPUnit_TextUI_TestRunner-doRun() C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:176 0.10922750216 5. PHPUnit_Framework_TestSuite-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398 0.10922761344 6. PHPUnit_Framework_TestCase-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716 0.10922762088 7. PHPUnit_Framework_TestResult-run() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693 0.12482817952 8. PHPUnit_Framework_TestCase-runBare() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609 0.12482909168 9. App\Test\TestCase\View\Helper\ProgressHelperTest-setUp() E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733 My question: How do I fix this so that the documented test works ? -- 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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.