2020 */
2121class AbstractCommandTest extends TestCase
2222{
23+ /**
24+ * @var TestableAbstractCommand
25+ */
2326 protected $ command ;
2427
2528 public function setUp ()
@@ -40,6 +43,9 @@ public function testParseDbNameWithoutDbName()
4043
4144 public function testTransformToLogicalName ()
4245 {
46+ $ bundleDir = realpath (__DIR__ . '/../Fixtures/src/My/SuperBundle ' );
47+ $ filename = 'Resources ' . DIRECTORY_SEPARATOR . 'config ' . DIRECTORY_SEPARATOR . 'a-schema.xml ' ;
48+
4349 $ bundle = $ this ->getMock ('Symfony\Component\HttpKernel\Bundle\BundleInterface ' );
4450 $ bundle
4551 ->expects ($ this ->once ())
@@ -48,47 +54,30 @@ public function testTransformToLogicalName()
4854 $ bundle
4955 ->expects ($ this ->once ())
5056 ->method ('getPath ' )
51- ->will ($ this ->returnValue ('/Users/foo/project/src/My/SuperBundle ' ));
52-
53- $ schema = $ this
54- ->getMockBuilder ('\SplFileInfo ' )
55- ->disableOriginalConstructor ()
56- ->getMock ();
57- $ schema
58- ->expects ($ this ->once ())
59- ->method ('getRealPath ' )
60- ->will ($ this ->returnValue ('/Users/foo/project/src/My/SuperBundle '
61- . DIRECTORY_SEPARATOR . 'Resources ' . DIRECTORY_SEPARATOR . 'config ' . DIRECTORY_SEPARATOR . 'my-schema.xml ' ));
62-
63- $ expected = '@MySuperBundle/Resources/config/my-schema.xml ' ;
57+ ->will ($ this ->returnValue ($ bundleDir ));
6458
59+ $ schema = new \SplFileInfo ($ bundleDir . DIRECTORY_SEPARATOR . $ filename );
60+ $ expected = '@MySuperBundle/Resources/config/a-schema.xml ' ;
6561 $ this ->assertEquals ($ expected , $ this ->command ->transformToLogicalName ($ schema , $ bundle ));
6662 }
6763
6864 public function testTransformToLogicalNameWithSubDir ()
6965 {
66+ $ bundleDir = realpath (__DIR__ . '/../Fixtures/src/My/ThirdBundle ' );
67+ $ filename = 'Resources ' . DIRECTORY_SEPARATOR . 'config ' . DIRECTORY_SEPARATOR . 'propel ' . DIRECTORY_SEPARATOR . 'schema.xml ' ;
68+
7069 $ bundle = $ this ->getMock ('Symfony\Component\HttpKernel\Bundle\BundleInterface ' );
7170 $ bundle
7271 ->expects ($ this ->once ())
7372 ->method ('getName ' )
74- ->will ($ this ->returnValue ('MySuperBundle ' ));
73+ ->will ($ this ->returnValue ('MyThirdBundle ' ));
7574 $ bundle
7675 ->expects ($ this ->once ())
7776 ->method ('getPath ' )
78- ->will ($ this ->returnValue ('/Users/foo/project/src/My/SuperBundle ' ));
79-
80- $ schema = $ this
81- ->getMockBuilder ('\SplFileInfo ' )
82- ->disableOriginalConstructor ()
83- ->getMock ();
84- $ schema
85- ->expects ($ this ->once ())
86- ->method ('getRealPath ' )
87- ->will ($ this ->returnValue ('/Users/foo/project/src/My/SuperBundle '
88- . DIRECTORY_SEPARATOR . 'Resources ' . DIRECTORY_SEPARATOR . 'config ' . DIRECTORY_SEPARATOR . 'propel/my-schema.xml ' ));
89-
90- $ expected = '@MySuperBundle/Resources/config/propel/my-schema.xml ' ;
77+ ->will ($ this ->returnValue ($ bundleDir ));
9178
79+ $ schema = new \SplFileInfo ($ bundleDir . DIRECTORY_SEPARATOR . $ filename );
80+ $ expected = '@MyThirdBundle/Resources/config/propel/schema.xml ' ;
9281 $ this ->assertEquals ($ expected , $ this ->command ->transformToLogicalName ($ schema , $ bundle ));
9382 }
9483
0 commit comments