Skip to content

Commit cfc0762

Browse files
committed
Merge branch '1.1'
2 parents 5d5348b + b3c6738 commit cfc0762

File tree

8 files changed

+49
-38
lines changed

8 files changed

+49
-38
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ before_script:
2222
- composer self-update
2323
- composer require symfony/symfony:${SYMFONY_VERSION} --prefer-source
2424

25-
script: vendor/bin/phpunit -c phpunit.xml.dist --coverage-text
25+
script: phpunit --coverage-text
2626

2727
notifications:
2828
irc: "irc.freenode.org#symfony-cmf"

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020
"jackalope/jackalope": "~1.0",
2121
"jackalope/jackalope-doctrine-dbal": "~1.0"
2222
},
23-
"require-dev": {
24-
"phpunit/phpunit": "3.7.*"
25-
},
2623
"autoload": {
2724
"psr-4": {
2825
"Symfony\\Cmf\\Component\\Testing\\": "src/"
2926
}
3027
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"Symfony\\Cmf\\Component\\Testing\\Tests\\": "tests/"
31+
}
32+
},
3133
"extra": {
3234
"branch-alias": {
3335
"dev-master": "1.2-dev"

tests/Fixtures/TestTestCase.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Symfony\Cmf\Component\Testing\Tests\Fixtures;
4+
5+
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
6+
use Symfony\Component\HttpKernel\KernelInterface;
7+
8+
class TestTestCase extends BaseTestCase
9+
{
10+
public function setKernel(KernelInterface $kernel)
11+
{
12+
self::$kernel = $kernel;
13+
}
14+
15+
protected static function createKernel(array $options = array())
16+
{
17+
if (null === self::$kernel) {
18+
return parent::createKernel($options);
19+
}
20+
21+
return self::$kernel;
22+
}
23+
}

tests/Functional/BaseTestCaseTest.php

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,42 @@
1010
*/
1111

1212

13-
namespace Tests\Functional;
13+
namespace Symfony\Cmf\Component\Testing\Tests\Functional;
1414

15+
use Symfony\Cmf\Component\Testing\Tests\Fixtures\TestTestCase;
1516
use Symfony\Cmf\Component\Testing\HttpKernel\TestKernel;
1617
use Symfony\Component\Config\Loader\LoaderInterface;
1718

1819
class BaseTestCaseTest extends \PHPUnit_Framework_TestCase
1920
{
2021
public function setUp()
2122
{
22-
$me = $this;
23-
24-
$this->tc = $this->getMockBuilder(
25-
'Symfony\Cmf\Component\Testing\Functional\BaseTestCase'
26-
)->setMethods(array(
27-
'createKernel',
28-
))->getMockForAbstractClass();
23+
$this->testCase = new TestTestCase();
2924

30-
$this->container = $this->getMock(
31-
'Symfony\Component\DependencyInjection\ContainerInterface'
32-
);
33-
34-
$this->kernel = $this->getMock(
35-
'Symfony\Component\HttpKernel\KernelInterface'
36-
);
37-
38-
$this->client = $me->getMockBuilder(
39-
'Symfony\Bundle\FrameworkBundle\Client'
40-
)->disableOriginalConstructor()->getMock();
25+
$this->container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
4126

27+
$me = $this;
4228
$this->container->expects($this->any())
4329
->method('get')
4430
->will($this->returnCallback(function ($name) use ($me) {
4531
$dic = array(
46-
'test.client' => $me->client
32+
'test.client' => $me->client,
4733
);
4834

4935
return $dic[$name];
5036
}));
5137

38+
$this->kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
39+
40+
$this->testCase->setKernel($this->kernel);
41+
5242
$this->kernel->expects($this->any())
5343
->method('getContainer')
5444
->will($this->returnValue($this->container));
5545

56-
$tc = $this->tc;
57-
$tc::staticExpects($this->any())
58-
->method('createKernel')
59-
->will($this->returnValue($this->kernel));
46+
$this->client = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Client')
47+
->disableOriginalConstructor()
48+
->getMock();
6049

6150
$this->client->expects($this->any())
6251
->method('getContainer')
@@ -66,8 +55,7 @@ public function setUp()
6655

6756
public function testGetContainer()
6857
{
69-
$res = $this->tc->getContainer();
70-
$this->assertEquals($this->container, $res);
58+
$this->assertEquals($this->container, $this->testCase->getContainer());
7159
}
7260

7361
public function provideTestDb()
@@ -87,12 +75,10 @@ public function provideTestDb()
8775
public function testDb($dbName, $expected)
8876
{
8977
if (null === $expected) {
90-
$this->setExpectedException('InvalidArgumentException',
91-
$dbName.'" does not exist'
92-
);
78+
$this->setExpectedException('InvalidArgumentException', $dbName.'" does not exist');
9379
}
9480

95-
$res = $this->tc->getDbManager($dbName);
81+
$res = $this->testCase->getDbManager($dbName);
9682

9783
$className = sprintf(
9884
'Symfony\Cmf\Component\Testing\Functional\DbManager\%s',

tests/HttpKernel/TestKernelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
namespace Tests\HttpKernel;
13+
namespace Symfony\Cmf\Component\Testing\Tests\HttpKernel;
1414

1515
use Symfony\Cmf\Component\Testing\HttpKernel\TestKernel;
1616
use Symfony\Component\Config\Loader\LoaderInterface;

tests/Phpunit/DatabaseTestListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
namespace Tests\Phpunit;
13+
namespace Symfony\Cmf\Component\Testing\Tests\Phpunit;
1414

1515
use Symfony\Cmf\Component\Testing\Phpunit\DatabaseTestListener;
1616

tests/Unit/Constraint/SchemaAcceptsXmlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
namespace Tests\Unit\Constraint;
13+
namespace Symfony\Cmf\Component\Testing\Tests\Unit\Constraint;
1414

1515
use Symfony\Cmf\Component\Testing\Unit\Constraint\SchemaAcceptsXml;
1616

tests/Unit/XmlSchemaTestCaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
namespace Tests\Unit;
13+
namespace Symfony\Cmf\Component\Testing\Tests\Unit;
1414

1515
use Symfony\Cmf\Component\Testing\Unit\XmlSchemaTestCase;
1616

0 commit comments

Comments
 (0)