@@ -26,14 +26,14 @@ public function setUp()
2626 $ this ->markTestSkipped ('The Propel submodule is not installed. ' );
2727 }
2828 }
29-
29+
3030 public function testRegisterWithProperties ()
3131 {
3232 $ app = new Application ();
3333 $ app ->register (new PropelServiceProvider (), array (
3434 'propel.path ' => __DIR__ . '/../../../../vendor/propel/runtime/lib ' ,
35- 'propel.config_file ' => __DIR__ . '/PropelFixtures/build/conf/myproject-conf.php ' ,
36- 'propel.model_path ' => __DIR__ . '/PropelFixtures/build/classes ' ,
35+ 'propel.config_file ' => __DIR__ . '/PropelFixtures/FixtFull/ build/conf/myproject-conf.php ' ,
36+ 'propel.model_path ' => __DIR__ . '/PropelFixtures/FixtFull/ build/classes ' ,
3737 ));
3838
3939 $ this ->assertTrue (class_exists ('Propel ' ));
@@ -43,7 +43,7 @@ public function testRegisterWithProperties()
4343 public function testRegisterDefaults ()
4444 {
4545 $ current = getcwd ();
46- chdir (__DIR__ .'/PropelFixtures ' );
46+ chdir (__DIR__ .'/PropelFixtures/FixtFull ' );
4747
4848 $ app = new Application ();
4949 $ app ->register (new PropelServiceProvider ());
@@ -58,12 +58,71 @@ public function testRegisterInternalAutoload()
5858 $ app = new Application ();
5959 $ app ->register (new PropelServiceProvider (), array (
6060 'propel.path ' => __DIR__ .'/../../../../vendor/propel/runtime/lib ' ,
61- 'propel.config_file ' => __DIR__ .'/PropelFixtures/build/conf/myproject-conf.php ' ,
62- 'propel.model_path ' => __DIR__ .'/PropelFixtures/build/classes ' ,
61+ 'propel.config_file ' => __DIR__ .'/PropelFixtures/FixtFull/ build/conf/myproject-conf.php ' ,
62+ 'propel.model_path ' => __DIR__ .'/PropelFixtures/FixtFull/ build/classes ' ,
6363 'propel.internal_autoload ' => true ,
6464 ));
6565
6666 $ this ->assertTrue (class_exists ('Propel ' ), 'Propel class does not exist. ' );
6767 $ this ->assertGreaterThan (strpos (get_include_path (), $ app ['propel.model_path ' ]), 1 );
6868 }
69+
70+ /**
71+ * @expectedException InvalidArgumentException
72+ * @expectedExceptionMessage Propel\Silex\PropelServiceProvider: please, initialize the "propel.model_path" parameter (did you already generate your model?)
73+ */
74+ public function testModelPathPropertyNotInitialized ()
75+ {
76+ $ app = new Application ();
77+ $ app ->register (new PropelServiceProvider ());
78+ }
79+
80+ /**
81+ * @expectedException InvalidArgumentException
82+ * @expectedExceptionMessage Propel\Silex\PropelServiceProvider: please, initialize the "propel.config_file" parameter.
83+ */
84+ public function testConfigFilePropertyNotInitialized ()
85+ {
86+ $ app = new Application ();
87+ $ app ->register (new PropelServiceProvider (), array (
88+ 'propel.path ' => __DIR__ .'/../../../../vendor/propel/runtime/lib ' ,
89+ 'propel.model_path ' => __DIR__ .'/PropelFixtures/FixtFull/build/classes ' ,
90+ ));
91+ }
92+
93+ public function testWrongConfigFile ()
94+ {
95+ $ current = getcwd ();
96+ try
97+ {
98+ chdir (__DIR__ .'/PropelFixtures/FixtEmpty ' );
99+ $ app = new Application ();
100+ $ app ->register (new PropelServiceProvider (), array (
101+ 'propel.path ' => __DIR__ .'/../../../../vendor/propel/runtime/lib ' ,
102+ 'propel.model_path ' => __DIR__ .'/PropelFixtures/FixtFull/build/classes ' ,
103+ ));
104+ }
105+ catch (\InvalidArgumentException $ e )
106+ {
107+ chdir ($ current );
108+ return ;
109+ }
110+
111+ chdir ($ current );
112+ $ this ->failed ('An expected InvalidArgumentException has not been raised ' );
113+ }
114+
115+ /**
116+ * @expectedException InvalidArgumentException
117+ */
118+ public function testNoNamespace ()
119+ {
120+ $ app = new Application ();
121+ $ app ->register (new PropelServiceProvider (), array (
122+ 'propel.path ' => __DIR__ .'/../../../../vendor/propel/runtime/lib ' ,
123+ 'propel.model_path ' => __DIR__ .'/PropelFixtures/FixtEmpty/build/classes ' ,
124+ 'propel.config_file ' => __DIR__ .'/PropelFixtures/FixtFull/build/conf/myproject-conf.php ' ,
125+ ));
126+ }
127+
69128}
0 commit comments