Permalink
Browse files

Added a unit test for the previous commit

  • Loading branch information...
1 parent c0221a6 commit 32423b077e3ca885d29a11781d1e5c9cf3756a08 @willdurand willdurand committed Dec 15, 2011
Showing with 46 additions and 0 deletions.
  1. +46 −0 Tests/Command/AbstractPropelCommandTest.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * This file is part of the PropelBundle package.
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @license MIT License
+ */
+
+namespace Tests\Command;
+
+use Propel\PropelBundle\Tests\TestCase;
+use Propel\PropelBundle\Command\AbstractPropelCommand;
+
+/**
+ * @author William Durand <william.durand1@gmail.com>
+ */
+class AbstractPropelCommandTest extends TestCase
+{
+ protected $command;
+
+ public function setUp()
+ {
+ $this->command = new TestableAbstractPropelCommand('testable-command');
+ }
+
+ public function testParseDbName()
+ {
+ $dsn = 'mydsn#dbname=foo';
+ $this->assertEquals('foo', $this->command->parseDbName($dsn));
+ }
+
+ public function testParseDbNameWithoutDbName()
+ {
+ $this->assertNull($this->command->parseDbName('foo'));
+ }
+}
+
+class TestableAbstractPropelCommand extends AbstractPropelCommand
+{
+ public function parseDbName($dsn)
+ {
+ return parent::parseDbName($dsn);
+ }
+}

0 comments on commit 32423b0

Please sign in to comment.