zendframework / ZendSkeletonModule

Sample skeleton module for use with the ZF2 MVC layer
BSD 3-Clause "New" or "Revised" License
207 stars 84 forks source link

Test Bootstrap don't work #25

Open seyfer opened 10 years ago

seyfer commented 10 years ago

Bootstrap don't work. Linked to this issue https://github.com/zendframework/ZendSkeletonModule/pull/19

if i run it

./vendor/bin/phpunit  --bootstrap=./module/Users/tests/bootstrap.php module/Users/tests/
PHP Fatal error:  Class 'UsersTest\Framework\TestCase' not found in /home/seyfer/www/zend2-tutorial.me/module/Users/tests/Users/SampleTest.php on line 18

Now i need include file by myself in SampleTest.php require_once 'Framework/TestCase.php';

Ok, now it runs, but assert fails

1) UsersTest\SampleTest::testSample
Failed asserting that null is an instance of interface "Zend\Di\LocatorInterface".

/home/seyfer/www/zend2-tutorial.me/module/Users/tests/Users/SampleTest.php:22

FAILURES!                            
Tests: 1, Assertions: 1, Failures: 1.

If i run it from module tests/ folder - same errors.

So, bootstrap by default don't work like it need to work. And after installing this ZendSkeletonModule users need to change Bootstrap for testing to something like: https://github.com/phly/PhlySimplePage/blob/master/test/Bootstrap.php or https://github.com/EvanDotPro/SpeckCart/blob/master/tests/Bootstrap.php

Why not include working Bootstrap.php by default?

Like framework user, i want working solution after install SkeletonModule and just add my Test classes and run it with configuration by default.

aaronjameslang commented 9 years ago

I second this strongly.

As someone new to PHP trying to learn ZF2, having the sample applications not work is very frustrating.