Skip to content

Commit

Permalink
# This is a combination of 5 commits.
Browse files Browse the repository at this point in the history
# The first commit's message is:
Update PHPUnit testing, using @Covers now.

# This is the 2nd commit message:

Update PHPUnit testing, using @Covers now.

# This is the 3rd commit message:

Fixed typo.

# This is the 4th commit message:

Fixed typo.

# This is the 5th commit message:

Update PHPUnit testing, using @Covers now.
  • Loading branch information
h4cc committed Aug 31, 2014
1 parent 84bf59d commit c364725
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 2 deletions.
36 changes: 36 additions & 0 deletions Tests/Command/LoadFilesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Class LoadFilesCommandTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\Command\LoadFilesCommand
*/
class LoadFilesCommandTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -55,6 +56,9 @@ public function setUp()
$container->set('h4cc_alice_fixtures.manager', $this->managerMock);
$container->set('h4cc_alice_fixtures.orm.schema_tool', $this->schemaToolMock);

$container->set('h4cc_alice_fixtures.mongodb_manager', $this->managerMock);
$container->set('h4cc_alice_fixtures.orm.mongodb_schema_tool', $this->schemaToolMock);

$this->command = $this->application->find('h4cc_alice_fixtures:load:files');
$this->command->setContainer($container);
}
Expand All @@ -74,6 +78,38 @@ public function testLoad()
);
}

public function testLoadWithoutDefaultManager()
{
$this->managerMock->expects($this->once())->method('load');

$tester = new CommandTester($this->command);

$tester->execute(
array(
'command' => $this->command->getName(),
'files' => array(__DIR__ . '/../../testdata/part_1.yml'),
'--manager' => 'mongodb',
'--drop' => true
)
);
}

public function testLoadWihtoutDefaultManager()
{
$this->managerMock->expects($this->once())->method('load');

$tester = new CommandTester($this->command);

$tester->execute(
array(
'command' => $this->command->getName(),
'files' => array(__DIR__ . '/../../testdata/part_1.yml'),
'--manager' => 'mongodb',
'--drop' => true
)
);
}

public function testLoadErrorNoFiles()
{
$tester = new CommandTester($this->command);
Expand Down
32 changes: 32 additions & 0 deletions Tests/Command/LoadSetsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Class LoadSetsCommandTest.
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\Command\LoadSetsCommand
*/
class LoadSetsCommandTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -57,6 +58,7 @@ public function setUp()

$container = new Container();
$container->set('h4cc_alice_fixtures.manager', $this->managerMock);
$container->set('h4cc_alice_fixtures.mongodb_manager', $this->managerMock);
$container->set('kernel', $this->kernelMock);

$this->command = $this->application->find('h4cc_alice_fixtures:load:sets');
Expand All @@ -74,6 +76,36 @@ public function testLoad()
);
}

public function testLoadWithoutDefaultManager()
{
$this->managerMock->expects($this->once())->method('load');

$tester = new CommandTester($this->command);

$tester->execute(
array(
'command' => $this->command->getName(),
'--manager' => 'mongodb',
'sets' => array(__DIR__ . '/../../testdata/SimpleSet.php'),
)
);
}

public function testLoadWithoutDefaultManager()
{
$this->managerMock->expects($this->once())->method('load');

$tester = new CommandTester($this->command);

$tester->execute(
array(
'command' => $this->command->getName(),
'--manager' => 'mongodb',
'sets' => array(__DIR__ . '/../../testdata/SimpleSet.php'),
)
);
}

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Class ProcessorCompilerPassTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\DependencyInjection\Compiler\ProcessorCompilerPass
*/
class ProcessorCompilerPassTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Class ProviderCompilerPassTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\DependencyInjection\Compiler\ProviderCompilerPass
*/
class ProviderCompilerPassTest extends \PHPUnit_Framework_TestCase
{
Expand Down
114 changes: 114 additions & 0 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php

/*
* This file is part of the h4cc/AliceFixtureBundle package.
*
* (c) Julius Beckmann <github@h4cc.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace h4cc\AliceFixturesBundle\Tests\DependencyInjection;

use h4cc\AliceFixturesBundle\DependencyInjection\Configuration;
use Matthias\SymfonyConfigTest\PhpUnit\AbstractConfigurationTestCase;

/**
* Class ConfiguratonTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\DependencyInjection\Configuration
*/
class ConfigurationTest extends AbstractConfigurationTestCase
{
protected function getConfiguration()
{
return new Configuration();
}

public function testDefaultConfiguration()
{
$this->assertProcessedConfigurationEquals(
// Input
array(),
// Expected output
array(
'managers' => array(),
)
);
}

public function testSimpleConfiguration()
{
$this->assertProcessedConfigurationEquals(
// Input
array(array(
'locale' => 'de_DE',
'seed' => 9876,
'do_flush' => false,

'object_manager' => 'doctrine_object_manager',
'schema_tool' => 'doctrine_schema_tool',

'doctrine' => 'mongodb-odm',

'default_manager' => 'default',
)),
// Expected output
array(
'default_manager' => 'default',
'managers' => array(
'default' => array(
'locale' => 'de_DE',
'seed' => 9876,
'do_flush' => false,

'object_manager' => 'doctrine_object_manager',
'schema_tool' => 'doctrine_schema_tool',

'doctrine' => 'mongodb-odm',
)
),
)
);
}

public function testMultiManagerConfiguration()
{
$this->assertProcessedConfigurationEquals(
// Input
array(array(
'default_manager' => 'my_manager',
'managers' => array(
'my_manager' => array(
'locale' => 'de_DE',
'seed' => 9876,
'do_flush' => false,

'object_manager' => 'doctrine_object_manager',
'schema_tool' => 'doctrine_schema_tool',

'doctrine' => 'mongodb-odm',
)
)
)),
// Expected output
array(
'default_manager' => 'my_manager',
'managers' => array(
'my_manager' => array(
'locale' => 'de_DE',
'seed' => 9876,
'do_flush' => false,

'object_manager' => 'doctrine_object_manager',
'schema_tool' => 'doctrine_schema_tool',

'doctrine' => 'mongodb-odm',
)
),
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Class h4ccAliceFixturesExtensionTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\DependencyInjection\h4ccAliceFixturesExtension
*/
class h4ccAliceFixturesExtensionTest extends \PHPUnit_Framework_TestCase
{
Expand Down
1 change: 1 addition & 0 deletions Tests/Fixture/FixtureManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Class FixtureManagerTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\Fixtures\FixtureManager
*/
class FixtureManagerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
1 change: 1 addition & 0 deletions Tests/Fixture/FixtureSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Class FixtureSetTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\Fixtures\FixtureSet
*/
class FixtureSetTest extends \PHPUnit_Framework_TestCase
{
Expand Down
1 change: 1 addition & 0 deletions Tests/Loader/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Class FactoryTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\Loader\Factory
*/
class FactoryTest extends \PHPUnit_Framework_TestCase
{
Expand Down
1 change: 1 addition & 0 deletions Tests/h4ccAliceFixturesBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Class h4ccAliceFixturesBundleTest
*
* @author Julius Beckmann <github@h4cc.de>
* @covers h4cc\AliceFixturesBundle\h4ccAliceFixturesBundle
*/
class h4ccAliceFixturesBundleTest extends \PHPUnit_Framework_TestCase
{
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"symfony/framework-bundle": "~2.1",
"doctrine/orm": "~2.1",
"doctrine/mongodb-odm": "1.0.*@dev",
"doctrine/mongodb-odm-bundle": "3.0.*@dev"
"doctrine/mongodb-odm-bundle": "3.0.*@dev",
"matthiasnoback/symfony-config-test": "~0.2.1"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="Tests/bootstrap.php">
<phpunit
colors="true"
bootstrap="Tests/bootstrap.php"
forceCoversAnnotation="true"
>

<testsuites>
<testsuite name="AliceFixturesBundle Test Suite">
Expand Down

0 comments on commit c364725

Please sign in to comment.