symfony-cmf / media-bundle

UNMAINTAINED - Minimalistic interfaces to handle media in the context of the CMF
http://cmf.symfony.com/
30 stars 40 forks source link

Add Testing component #38

Closed rmsint closed 11 years ago

rmsint commented 11 years ago
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets https://github.com/symfony-cmf/MediaBundle/issues/30
License MIT
Doc PR n/a

Tests are not included and can be added in this PR or later separately.

rmsint commented 11 years ago

@dantleech with the current version of the testing component I get underneath error, do you know perhaps how to solve this? Also the test app does not have the server:run command registered, do you see maybe what is done wrong?

PHP Fatal error: Class 'Doctrine\ORM\Version' not found in xx/cmf-sandbox/vendor/symfony-cmf/media-bundle/Symfony/Cmf/Bundle/MediaBundle/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php on line 298

dantleech commented 11 years ago

Hmm, that's probably caused by the latest merge which introduced ORM support, best to find out what is trying to instantiate that Version class and fix it. (I am away from computer ATM).

For server:run you need PHP5.4 otherwise you can serve the web directory in treating component in Apache.

rmsint commented 11 years ago

@dantleech Thanks, got it working. Checked out an older version of the testing component and used PHP5.4.

rmsint commented 11 years ago

Found some fixes to be done during writing an application file test:

rmsint commented 11 years ago

@dantleech, @sjopet are you ok to merge this? Then we can add tests in other PRs separately, I think we will move faster then.

dantleech commented 11 years ago

Looks good @rmsint , one thing that would be neat is if we could add a simple web test to test the file page of the test application:

// something like Tests/WebTest/TestApp/FileTest.php
public function testPage()
{
$client = $this->createClient();
$client->get('/file'); // or $this->getContainer()->get('route')->generate('route_name')
$resp = $client->getResponse();
$this->assertEquals(200, $resp->getStatusCode());
}

This is a really basic, but extremely useful way of testing for regressions (providing != 200 means an error :)

rmsint commented 11 years ago

Thanks @dantleech, added also the WebTest case. Works really nice the testing component! I'd like to add more application test pages and WebTestCases to test and demo the different features.