Browse Source

added session resolver tests.

Taylor Otwell 13 years ago
parent
commit
a97c45e034
2 changed files with 20 additions and 3 deletions
  1. 3 3
      laravel/config/container.php
  2. 17 0
      tests/Session/SessionResolverTest.php

+ 3 - 3
laravel/config/container.php

@@ -221,11 +221,11 @@ return array(
 
 	'laravel.session.cookie' => array('resolver' => function($container)
 	{
-		$cookies = $container->resolve('laravel.request')->input->cookies;
+		$cookies = $container->resolve('laravel.cookie');
 
 		$config = $container->resolve('laravel.config')->get('session');
 
-		return new Session\Drivers\Cookie(Security\Crypter::make(), $cookies);
+		return new Session\Drivers\Cookie($container->resolve('laravel.crypter'), $cookies);
 	}),
 
 	/*
@@ -238,7 +238,7 @@ return array(
 	{
 		$table = $container->resolve('laravel.config')->get('session.table');
 
-		return new Session\Drivers\Database($container->resolve('laravel.database.manager')->connection());
+		return new Session\Drivers\Database($container->resolve('laravel.database')->connection());
 	}),
 
 	/*

+ 17 - 0
tests/Session/SessionResolverTest.php

@@ -0,0 +1,17 @@
+<?php
+
+class SessionResolverTest extends PHPUnit_Framework_TestCase {
+
+	public function testDriversCanBeResolved()
+	{
+		IoC::resolve('laravel.config')->set('application.key', 'something');
+
+		$this->assertInstanceOf('Laravel\\Session\\Manager', IoC::resolve('laravel.session.manager'));
+		$this->assertInstanceOf('Laravel\\Session\\Drivers\\APC', IoC::resolve('laravel.session.apc'));
+		$this->assertInstanceOf('Laravel\\Session\\Drivers\\Cookie', IoC::resolve('laravel.session.cookie'));
+		$this->assertInstanceOf('Laravel\\Session\\Drivers\\Database', IoC::resolve('laravel.session.database'));
+		$this->assertInstanceOf('Laravel\\Session\\Drivers\\File', IoC::resolve('laravel.session.file'));
+		$this->assertInstanceOf('Laravel\\Session\\Drivers\\Memcached', IoC::resolve('laravel.session.memcached'));
+	}
+
+}