Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 6787962

Browse files
committed
Merge pull request #39 from dantleech/testing-component
Testing component
2 parents 212cded + 570d30f commit 6787962

18 files changed

+87
-204
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
vendor
22
composer.lock
33
composer.phar
4-
Tests/Functional/config/parameters.yml
5-
Tests/Functional/app.sqlite
4+
Tests/Resources/app/cache

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ env:
1111
- SYMFONY_VERSION=dev-master
1212

1313
before_script:
14-
- composer require symfony/routing:${SYMFONY_VERSION} --no-update
14+
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
1515
- composer install --dev
16-
- cp ./Tests/Functional/config/parameters.yml.dist ./Tests/Functional/config/parameters.yml
17-
- php Tests/Functional/console doctrine:phpcr:init:dbal
18-
- php Tests/Functional/console doctrine:phpcr:register-system-node-types
16+
- vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh
1917

2018
script: phpunit --coverage-text
2119

Tests/Functional/AppKernel.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

Tests/Functional/BaseTestCase.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

Tests/Functional/PHPCR/PHPCRBrowserTest.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Tests\Functional\PHPCR;
44

5-
use Symfony\Cmf\Bundle\TreeBrowserBundle\Tests\Functional\BaseTestCase;
5+
6+
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
67

78
/**
89
* Functional test for PHPCRBrowser
@@ -19,10 +20,13 @@ public function testGetChildrenListFromRoot()
1920
$client = $this->createClient();
2021

2122
$client->request('GET', '/_cmf_tree/phpcr_tree/children');
23+
$response = $client->getResponse();
24+
25+
$this->assertEquals(200, $response->getStatusCode());
2226

2327
$this->assertEquals(
24-
$client->getResponse()->getContent(),
25-
'[{"data":"cms","attr":{"id":"\/cms","url_safe_id":"cms","rel":"node"},"state":"closed","children":[{"data":"content","attr":{"id":"\/cms\/content","url_safe_id":"cms\/content","rel":"node"},"state":"closed"}]},{"data":"menus","attr":{"id":"\/menus","url_safe_id":"menus","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/menus\/test","url_safe_id":"menus\/test","rel":"node"},"state":null}]}]'
28+
'[{"data":"cms","attr":{"id":"\/cms","url_safe_id":"cms","rel":"node"},"state":"closed","children":[{"data":"content","attr":{"id":"\/cms\/content","url_safe_id":"cms\/content","rel":"node"},"state":"closed"}]},{"data":"menus","attr":{"id":"\/menus","url_safe_id":"menus","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/menus\/test","url_safe_id":"menus\/test","rel":"node"},"state":null}]}]',
29+
$client->getResponse()->getContent()
2630
);
2731
}
2832

@@ -33,20 +37,19 @@ public function testGetChildrenListFromInnerNode()
3337
$client = $this->createClient();
3438

3539
$crawler = $client->request('GET', '/_cmf_tree/phpcr_tree/children?root=%2Fcms%2Fcontent');
40+
$response = $client->getResponse();
41+
42+
$this->assertEquals(200, $response->getStatusCode());
3643

3744
$this->assertEquals(
38-
$client->getResponse()->getContent(),
39-
'[{"data":"static","attr":{"id":"\/cms\/content\/static","url_safe_id":"cms\/content\/static","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/cms\/content\/static\/test","url_safe_id":"cms\/content\/static\/test","rel":"node"},"state":null}]}]'
45+
'[{"data":"static","attr":{"id":"\/cms\/content\/static","url_safe_id":"cms\/content\/static","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/cms\/content\/static\/test","url_safe_id":"cms\/content\/static\/test","rel":"node"},"state":null}]}]',
46+
$client->getResponse()->getContent()
4047
);
4148
}
4249

4350
protected function loadFixtures()
4451
{
45-
self::$kernel = self::createKernel();
46-
self::$kernel->init();
47-
self::$kernel->boot();
48-
49-
$session = self::$kernel->getContainer()->get('doctrine_phpcr.session');
52+
$session = $this->getContainer()->get('doctrine_phpcr.session');
5053
if ($session->nodeExists("/cms")) {
5154
$session->getNode("/cms")->remove();
5255
}
@@ -65,4 +68,4 @@ protected function loadFixtures()
6568
$session->save();
6669
}
6770

68-
}
71+
}

Tests/Functional/config/default.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Tests/Functional/config/doctrine.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Tests/Functional/config/framework.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

Tests/Functional/config/parameters.yml.dist

Lines changed: 0 additions & 14 deletions
This file was deleted.

Tests/Functional/config/phpcrodm.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)