Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added more tests and related fixtures

  • Loading branch information...
commit f1360c3faaa6285cd2787ae85bc9e479fcf262e6 1 parent 447ef74
Cristiano Cinotti cristianoc72 authored
0  ...elFixtures/build/conf/classmap-myproject-conf.php → ...s/FixtFull/build/conf/classmap-myproject-conf.php
View
File renamed without changes
0  ...ilex/PropelFixtures/build/conf/myproject-conf.php → ...elFixtures/FixtFull/build/conf/myproject-conf.php
View
File renamed without changes
71 tests/Propel/Tests/Silex/PropelServiceProviderTest.php
View
@@ -26,14 +26,14 @@ public function setUp()
$this->markTestSkipped('The Propel submodule is not installed.');
}
}
-
+
public function testRegisterWithProperties()
{
$app = new Application();
$app->register(new PropelServiceProvider(), array(
'propel.path' => __DIR__ . '/../../../../vendor/propel/runtime/lib',
- 'propel.config_file' => __DIR__ . '/PropelFixtures/build/conf/myproject-conf.php',
- 'propel.model_path' => __DIR__ . '/PropelFixtures/build/classes',
+ 'propel.config_file' => __DIR__ . '/PropelFixtures/FixtFull/build/conf/myproject-conf.php',
+ 'propel.model_path' => __DIR__ . '/PropelFixtures/FixtFull/build/classes',
));
$this->assertTrue(class_exists('Propel'));
@@ -43,7 +43,7 @@ public function testRegisterWithProperties()
public function testRegisterDefaults()
{
$current = getcwd();
- chdir(__DIR__.'/PropelFixtures');
+ chdir(__DIR__.'/PropelFixtures/FixtFull');
$app = new Application();
$app->register(new PropelServiceProvider());
@@ -58,12 +58,71 @@ public function testRegisterInternalAutoload()
$app = new Application();
$app->register(new PropelServiceProvider(), array(
'propel.path' => __DIR__.'/../../../../vendor/propel/runtime/lib',
- 'propel.config_file' => __DIR__.'/PropelFixtures/build/conf/myproject-conf.php',
- 'propel.model_path' => __DIR__.'/PropelFixtures/build/classes',
+ 'propel.config_file' => __DIR__.'/PropelFixtures/FixtFull/build/conf/myproject-conf.php',
+ 'propel.model_path' => __DIR__.'/PropelFixtures/FixtFull/build/classes',
'propel.internal_autoload' => true,
));
$this->assertTrue(class_exists('Propel'), 'Propel class does not exist.');
$this->assertGreaterThan(strpos(get_include_path(), $app['propel.model_path']), 1);
}
+
+ /**
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage Propel\Silex\PropelServiceProvider: please, initialize the "propel.model_path" parameter (did you already generate your model?)
+ */
+ public function testModelPathPropertyNotInitialized()
+ {
+ $app = new Application();
+ $app->register(new PropelServiceProvider());
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage Propel\Silex\PropelServiceProvider: please, initialize the "propel.config_file" parameter.
+ */
+ public function testConfigFilePropertyNotInitialized()
+ {
+ $app = new Application();
+ $app->register(new PropelServiceProvider(), array(
+ 'propel.path' => __DIR__.'/../../../../vendor/propel/runtime/lib',
+ 'propel.model_path' => __DIR__.'/PropelFixtures/FixtFull/build/classes',
+ ));
+ }
+
+ public function testWrongConfigFile()
+ {
+ $current = getcwd();
+ try
+ {
+ chdir(__DIR__.'/PropelFixtures/FixtEmpty');
+ $app = new Application();
+ $app->register(new PropelServiceProvider(), array(
+ 'propel.path' => __DIR__.'/../../../../vendor/propel/runtime/lib',
+ 'propel.model_path' => __DIR__.'/PropelFixtures/FixtFull/build/classes',
+ ));
+ }
+ catch(\InvalidArgumentException $e)
+ {
+ chdir($current);
+ return;
+ }
+
+ chdir($current);
+ $this->failed('An expected InvalidArgumentException has not been raised');
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testNoNamespace()
+ {
+ $app = new Application();
+ $app->register(new PropelServiceProvider(), array(
+ 'propel.path' => __DIR__.'/../../../../vendor/propel/runtime/lib',
+ 'propel.model_path' => __DIR__.'/PropelFixtures/FixtEmpty/build/classes',
+ 'propel.config_file' => __DIR__.'/PropelFixtures/FixtFull/build/conf/myproject-conf.php',
+ ));
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.