language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
laravel
framework
acb7f0e409b0088d0b318cf7df063754bb28a9fe.json
Use artisan for seeding.
src/Illuminate/Foundation/Testing/TestCase.php
@@ -355,7 +355,7 @@ public function be(UserInterface $user, $driver = null) */ public function seed($class = 'DatabaseSeeder') { - $this->app[$class]->run(); + $this->app['artisan']->call('seed', array('--class' => $class)); } /**
false
Other
laravel
framework
35b6a0f26d66861bc558f548c9fe076fad369a75.json
Modify all() to work with nested input arrays
src/Illuminate/Http/Request.php
@@ -174,7 +174,7 @@ public function has($key) */ public function all() { - return $this->input() + $this->files->all(); + return array_merge_recursive($this->input(), $this->files->all()); } /**
true
Other
laravel
framework
35b6a0f26d66861bc558f548c9fe076fad369a75.json
Modify all() to work with nested input arrays
tests/Http/HttpRequestTest.php
@@ -238,6 +238,14 @@ public function testAllInputReturnsInputAndFiles() } + public function testAllInputReturnsNestedInputAndFiles() + { + $file = $this->getMock('Symfony\Component\HttpFoundation\File\UploadedFile', null, array(__FILE__, 'photo.jpg')); + $request = Request::create('/?boom=breeze', 'GET', array('foo' => array('bar' => 'baz')), array(), array('foo' => array('photo' => $file))); + $this->assertEquals(array('foo' => array('bar' => 'baz', 'photo' => $file), 'boom' => 'breeze'), $request->all()); + } + + public function testOldMethodCallsSession() { $request = Request::create('/', 'GET');
true
Other
laravel
framework
7b32cb1eb991132f537a3349947cde711245c5fa.json
Fix bug in container isShared.
src/Illuminate/Container/Container.php
@@ -373,7 +373,14 @@ protected function rebound($abstract) */ protected function getReboundCallbacks($abstract) { - return array_get($this->reboundCallbacks, $abstract, array()); + if (isset($this->reboundCallbacks[$abstract])) + { + return $this->reboundCallbacks[$abstract]; + } + else + { + return array(); + } } /** @@ -634,7 +641,14 @@ protected function fireCallbackArray($object, array $callbacks) */ public function isShared($abstract) { - $shared = array_get($this->bindings, "{$abstract}.shared"); + if (isset($this->bindings[$abstract]['shared'])) + { + $shared = $this->bindings[$abstract]['shared']; + } + else + { + $shared = false; + } return isset($this->instances[$abstract]) || $shared === true; }
false
Other
laravel
framework
6f522cbc05aaf23e242800bef5412d9c5a12ea47.json
Fix command output for seeder.
src/Illuminate/Database/Seeder.php
@@ -36,7 +36,10 @@ public function call($class) { $this->resolve($class)->run(); - $this->command->getOutput()->writeln("<info>Seeded:</info> $class"); + if ( ! is_null($this->command)) + { + $this->command->getOutput()->writeln("<info>Seeded:</info> $class"); + } } /**
true
Other
laravel
framework
6f522cbc05aaf23e242800bef5412d9c5a12ea47.json
Fix command output for seeder.
tests/Database/DatabaseSeederTest.php
@@ -28,4 +28,18 @@ public function testCallResolveTheClassAndCallsRun() $seeder->call('ClassName'); } + public function testSetContainer() + { + $seeder = new Seeder; + $container = m::mock('Illuminate\Container\Container'); + $this->assertEquals($seeder->setContainer($container), $seeder); + } + + public function testSetCommand() + { + $seeder = new Seeder; + $command = m::mock('Illuminate\Console\Command'); + $this->assertEquals($seeder->setCommand($command), $seeder); + } + } \ No newline at end of file
true
Other
laravel
framework
c6d4546ad866cd32d7bd9b2d8a2ed7a0a03ff346.json
Add prefix to key.
src/Illuminate/Cache/RedisTaggedCache.php
@@ -13,7 +13,7 @@ public function forever($key, $value) { $this->pushForeverKeys($namespace = $this->tags->getNamespace(), $key); - parent::forever($key, $value); + $this->store->forever($this->getPrefix().sha1($namespace).':'.$key, $value); } /**
false
Other
laravel
framework
5076824d4c0d4299522010ddb0bf03e7c96278ec.json
Increase memory limit for framework tests.
.travis.yml
@@ -1,12 +1,13 @@ language: php -php: +php: - 5.3 - 5.4 - 5.5 before_script: + - phpenv config-add travis.php.ini - curl -s http://getcomposer.org/installer | php - php composer.phar install --prefer-source --no-interaction --dev -script: phpunit +script: phpunit \ No newline at end of file
true
Other
laravel
framework
5076824d4c0d4299522010ddb0bf03e7c96278ec.json
Increase memory limit for framework tests.
travis.php.ini
@@ -0,0 +1 @@ +memory_limit = 1024M \ No newline at end of file
true
Other
laravel
framework
4e8fe094179116471e64c336d8516d4dd483e6ea.json
Remove extra space.
src/Illuminate/Cache/RedisTaggedCache.php
@@ -13,7 +13,7 @@ public function forever($key, $value) { $this->pushForeverKeys($namespace = $this->tags->getNamespace(), $key); - parent::forever( $key, $value); + parent::forever($key, $value); } /**
false
Other
laravel
framework
2b621879bae4669c27201f057106665e62456fa5.json
Remove unrequired method getLayout. Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
src/Illuminate/Routing/Controller.php
@@ -200,16 +200,6 @@ public function callAction($method, $parameters) return $response; } - /** - * Get the layout used by the controller. - * - * @return \Illuminate\View\View|null - */ - public function getLayout() - { - return $this->layout; - } - /** * Handle calls to missing methods on the controller. *
false
Other
laravel
framework
3d690c30a86a965d463f4c3410f57c198fd0d7a7.json
Add typehint to setPdo method
src/Illuminate/Database/Connection.php
@@ -652,9 +652,9 @@ public function getPdo() /** * Change the value of the currently used PDO connection. * - * @param mixed $pdo + * @param PDO|null $pdo */ - public function setPdo($pdo) + public function setPdo(PDO $pdo = null) { $this->pdo = $pdo; }
false
Other
laravel
framework
6debd53e976daf189637462f6040f64b1cbb25eb.json
Add more operators for various databases.
src/Illuminate/Database/Query/Builder.php
@@ -142,6 +142,7 @@ class Builder { protected $operators = array( '=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like', 'between', 'ilike', + '&', '|', '^', '<<', '>>', ); /**
true
Other
laravel
framework
6debd53e976daf189637462f6040f64b1cbb25eb.json
Add more operators for various databases.
src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
@@ -4,6 +4,17 @@ class PostgresGrammar extends Grammar { + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = array( + '=', '<', '>', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '|', '#', '<<', '>>', + ); + /** * Compile an update statement into SQL. *
true
Other
laravel
framework
6debd53e976daf189637462f6040f64b1cbb25eb.json
Add more operators for various databases.
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
@@ -4,6 +4,17 @@ class SQLiteGrammar extends Grammar { + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = array( + '=', '<', '>', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '|', '<<', '>>', + ); + /** * Compile an insert statement into SQL. *
true
Other
laravel
framework
6debd53e976daf189637462f6040f64b1cbb25eb.json
Add more operators for various databases.
src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
@@ -4,6 +4,17 @@ class SqlServerGrammar extends Grammar { + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = array( + '=', '<', '>', '<=', '>=', '!<', '!>', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '&=', '|', '|=', '^', '^=', + ); + /** * The keyword identifier wrapper format. * @@ -124,7 +135,7 @@ protected function compileRowConstraint($query) return "between {$start} and {$finish}"; } - + return ">= {$start}"; }
true
Other
laravel
framework
5046370454bed497801fe47e29efa00fab0535cd.json
Fix translator bug.
src/Illuminate/Translation/Translator.php
@@ -102,7 +102,7 @@ protected function getLine($namespace, $group, $locale, $item, array $replace) { return $this->makeReplacements($line, $replace); } - elseif (is_array($line)) + elseif (is_array($line) and ! is_null($item)) { return $line; }
false
Other
laravel
framework
07de62a58b7133165d5df6a2da5ef7902a3f28fd.json
Fix closure problem.
src/Illuminate/View/Compilers/BladeCompiler.php
@@ -195,7 +195,7 @@ protected function compileRegularEchos($value) $callback = function($matches) use ($me) { - return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$this->compileEchoDefaults($matches[2]).'; ?>'; + return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$me->compileEchoDefaults($matches[2]).'; ?>'; }; return preg_replace_callback($pattern, $callback, $value);
false
Other
laravel
framework
a2fe7b81d95a10045e362c7421216b6983b7446f.json
Fix typo in method name.
tests/Validation/ValidationValidatorTest.php
@@ -754,7 +754,7 @@ public function testBeforeAndAfter() } - public function testSoemtimesAddingRules() + public function testSometimesAddingRules() { $trans = $this->getRealTranslator(); $v = new Validator($trans, array('x' => 'foo'), array('x' => 'Required'));
false
Other
laravel
framework
d0fca1878a924a2319f5262e5f264f9d59e69418.json
Fix translator bug.
src/Illuminate/Translation/Translator.php
@@ -98,7 +98,14 @@ protected function getLine($namespace, $group, $locale, $item, array $replace) { $line = array_get($this->loaded[$namespace][$group][$locale], $item); - if (is_string($line)) return $this->makeReplacements($line, $replace); + if (is_string($line)) + { + return $this->makeReplacements($line, $replace); + } + elseif (is_array($line)) + { + return $line; + } } /**
false
Other
laravel
framework
9974593135da02ec2c6fc88a7414b3e308c2a687.json
Drop aliases when binding new abstracts.
src/Illuminate/Container/Container.php
@@ -92,7 +92,7 @@ public function bind($abstract, $concrete = null, $shared = false) // If no concrete type was given, we will simply set the concrete type to the // abstract type. This will allow concrete type to be registered as shared // without being forced to state their classes in both of the parameter. - unset($this->instances[$abstract]); + $this->dropStaleInstances($abstract); if (is_null($concrete)) { @@ -259,6 +259,8 @@ public function instance($abstract, $instance) $this->alias($abstract, $alias); } + unset($this->aliases[$abstract]); + // We'll check to determine if this type has been bound before, and if it has // we will fire the rebound callbacks registered with the container and it // can be updated with consuming classes that have gotten resolved here. @@ -648,6 +650,19 @@ public function getBindings() return $this->bindings; } + /** + * Drop all of the stale instances and aliases. + * + * @param string $abstract + * @return void + */ + protected function dropStaleInstances($abstract) + { + unset($this->instances[$abstract]); + + unset($this->aliases[$abstract]); + } + /** * Remove a resolved instance from the instance cache. *
true
Other
laravel
framework
9974593135da02ec2c6fc88a7414b3e308c2a687.json
Drop aliases when binding new abstracts.
src/Illuminate/Foundation/changes.json
@@ -34,7 +34,8 @@ {"message": "Added new hasManyThrough relationship type.", "backport": null}, {"message": "Cloned Eloquent query builders now clone the underlying query builder.", "backport": null}, {"message": "Allow for passing of custom attributes into Validator::make as fourth parameter.", "backport": null}, - {"message": "Allow comma delimited list of queues to be passed to queue:listen / queue:work to implement queue priority.", "backport": null} + {"message": "Allow comma delimited list of queues to be passed to queue:listen / queue:work to implement queue priority.", "backport": null}, + {"message": "When new bindings are added to container, old aliases bound to that key will now be dropped.", "backport": null} ], "4.0.x": [ {"message": "Added implode method to query builder and Collection class.", "backport": null},
true
Other
laravel
framework
99522e5c38cd62883ae2b040bc74554824a3a053.json
Boot the application on test refresh.
src/Illuminate/Foundation/Testing/TestCase.php
@@ -26,7 +26,12 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { */ public function setUp() { - if ( ! $this->app) $this->refreshApplication(); + if ( ! $this->app) + { + $this->refreshApplication(); + + $this->app->boot(); + } } /** @@ -292,7 +297,7 @@ public function assertSessionHasAll(array $bindings) /** * Assert that the session has errors bound. - * + * * @param string|array $bindings * @param mixed $format * @return void
false
Other
laravel
framework
adcb32f77a433770323654b5430f2a0a6fef4256.json
Make extend() return manager instance.
src/Illuminate/Support/Manager.php
@@ -98,11 +98,13 @@ protected function callCustomCreator($driver) * * @param string $driver * @param Closure $callback - * @return void + * @return \Illuminate\Support\Manager|static */ public function extend($driver, Closure $callback) { $this->customCreators[$driver] = $callback; + + return $this; } /** @@ -127,4 +129,4 @@ public function __call($method, $parameters) return call_user_func_array(array($this->driver(), $method), $parameters); } -} \ No newline at end of file +}
false
Other
laravel
framework
8fc497b5b92a08da3d32b18606b79eb7ece84286.json
Remove untrue change log.
src/Illuminate/Foundation/changes.json
@@ -6,7 +6,6 @@ {"message": "Added newest and oldest methods to query builder for timestamp short-hand queries.", "backport": null}, {"message": "Rebuild the routing layer for speed and efficiency.", "backport": null}, {"message": "Added morphToMany relation for polymorphic many-to-many relations.", "backport": null}, - {"message": "Deprecated column renaming. Deprecated dropping SQLite columns.", "backport": null}, {"message": "Added live debug console via 'debug' Artisan command.", "backport": null}, {"message": "Make Boris available from Tinker command when available.", "backport": null}, {"message": "Allow route names to be specified on resources.", "backport": null},
false
Other
laravel
framework
7107d30ae550c89b855a26231681c477c4983a54.json
Change action order.
src/Illuminate/Database/Eloquent/Model.php
@@ -668,10 +668,10 @@ public function hasMany($related, $foreignKey = null) */ public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null) { - $firstKey = $firstKey ?: $this->getForeignKey(); - $through = new $through; + $firstKey = $firstKey ?: $this->getForeignKey(); + $secondKey = $secondKey ?: $through->getForeignKey(); return new HasManyThrough(with(new $related)->newQuery(), $this, $through, $firstKey, $secondKey);
false
Other
laravel
framework
46ec7a4a370a190baa870ccd21a9f6e17d9131a8.json
Add hasManyThrough tests.
tests/Database/DatabaseEloquentHasManyThroughTest.php
@@ -0,0 +1,96 @@ +<?php + +use Mockery as m; +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Relations\HasManyThrough; + +class DatabaseEloquentHasManyTest extends PHPUnit_Framework_TestCase { + + public function tearDown() + { + m::close(); + } + + + public function testRelationIsProperlyInitialized() + { + $relation = $this->getRelation(); + $model = m::mock('Illuminate\Database\Eloquent\Model'); + $relation->getRelated()->shouldReceive('newCollection')->andReturnUsing(function($array = array()) { return new Collection($array); }); + $model->shouldReceive('setRelation')->once()->with('foo', m::type('Illuminate\Database\Eloquent\Collection')); + $models = $relation->initRelation(array($model), 'foo'); + + $this->assertEquals(array($model), $models); + } + + + public function testEagerConstraintsAreProperlyAdded() + { + $relation = $this->getRelation(); + $relation->getQuery()->shouldReceive('whereIn')->once()->with('users.country_id', array(1, 2)); + $model1 = new EloquentHasManyThroughModelStub; + $model1->id = 1; + $model2 = new EloquentHasManyThroughModelStub; + $model2->id = 2; + $relation->addEagerConstraints(array($model1, $model2)); + } + + + public function testModelsAreProperlyMatchedToParents() + { + $relation = $this->getRelation(); + + $result1 = new EloquentHasManyThroughModelStub; + $result1->country_id = 1; + $result2 = new EloquentHasManyThroughModelStub; + $result2->country_id = 2; + $result3 = new EloquentHasManyThroughModelStub; + $result3->country_id = 2; + + $model1 = new EloquentHasManyThroughModelStub; + $model1->id = 1; + $model2 = new EloquentHasManyThroughModelStub; + $model2->id = 2; + $model3 = new EloquentHasManyThroughModelStub; + $model3->id = 3; + + $relation->getRelated()->shouldReceive('newCollection')->andReturnUsing(function($array) { return new Collection($array); }); + $models = $relation->match(array($model1, $model2, $model3), new Collection(array($result1, $result2, $result3)), 'foo'); + + $this->assertEquals(1, $models[0]->foo[0]->country_id); + $this->assertEquals(1, count($models[0]->foo)); + $this->assertEquals(2, $models[1]->foo[0]->country_id); + $this->assertEquals(2, $models[1]->foo[1]->country_id); + $this->assertEquals(2, count($models[1]->foo)); + $this->assertEquals(0, count($models[2]->foo)); + } + + + protected function getRelation() + { + $builder = m::mock('Illuminate\Database\Eloquent\Builder'); + $builder->shouldReceive('join')->once()->with('users', 'users.id', '=', 'posts.user_id'); + $builder->shouldReceive('where')->with('users.country_id', '=', 1); + + $country = m::mock('Illuminate\Database\Eloquent\Model'); + $country->shouldReceive('getKey')->andReturn(1); + $country->shouldReceive('getForeignKey')->andReturn('country_id'); + $user = m::mock('Illuminate\Database\Eloquent\Model'); + $user->shouldReceive('getTable')->andReturn('users'); + $user->shouldReceive('getQualifiedKeyName')->andReturn('users.id'); + $post = m::mock('Illuminate\Database\Eloquent\Model'); + $post->shouldReceive('getTable')->andReturn('posts'); + + $builder->shouldReceive('getModel')->andReturn($post); + + $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getCreatedAtColumn')->andReturn('created_at'); + $user->shouldReceive('getUpdatedAtColumn')->andReturn('updated_at'); + return new HasManyThrough($builder, $country, $user, 'country_id', 'user_id'); + } + +} + +class EloquentHasManyThroughModelStub extends Illuminate\Database\Eloquent\Model { + public $country_id = 'foreign.value'; +} \ No newline at end of file
false
Other
laravel
framework
4fb411ec9ac803073065a5c6e56c43f9656ed2e8.json
Change visiblity of properties on pluralizer.
src/Illuminate/Support/Pluralizer.php
@@ -7,7 +7,7 @@ class Pluralizer { * * @var array */ - protected static $plural = array( + public static $plural = array( '/(quiz)$/i' => "$1zes", '/^(ox)$/i' => "$1en", '/([m|l])ouse$/i' => "$1ice", @@ -34,7 +34,7 @@ class Pluralizer { * * @var array */ - protected static $singular = array( + public static $singular = array( '/(quiz)zes$/i' => "$1", '/(matr)ices$/i' => "$1ix", '/(vert|ind)ices$/i' => "$1ex", @@ -71,7 +71,7 @@ class Pluralizer { * * @var array */ - protected static $irregular = array( + public static $irregular = array( 'child' => 'children', 'foot' => 'feet', 'goose' => 'geese', @@ -87,7 +87,7 @@ class Pluralizer { * * @var array */ - protected static $uncountable = array( + public static $uncountable = array( 'audio', 'equipment', 'deer', @@ -188,7 +188,7 @@ protected static function inflect($value, $source, $irregular) if (preg_match($pattern = '/'.$pattern.'$/i', $value)) { $irregular = static::matchCase($irregular, $value); - + return preg_replace($pattern, $irregular, $value); } }
false
Other
laravel
framework
ea1d3c89311e763d6c78d17325d21f2ad4614c1c.json
Fix MySQL unions with parens.
src/Illuminate/Database/Query/Grammars/Grammar.php
@@ -506,14 +506,25 @@ protected function compileUnions(Builder $query) foreach ($query->unions as $union) { - $joiner = $union['all'] ? ' union all ' : ' union '; - - $sql .= $joiner.$union['query']->toSql(); + $sql .= $this->compileUnion($union); } return ltrim($sql); } + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $joiner = $union['all'] ? ' union all ' : ' union '; + + return $joiner.$union['query']->toSql(); + } + /** * Compile an insert statement into SQL. *
true
Other
laravel
framework
ea1d3c89311e763d6c78d17325d21f2ad4614c1c.json
Fix MySQL unions with parens.
src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
@@ -11,6 +11,55 @@ class MySqlGrammar extends Grammar { */ protected $wrapper = '`%s`'; + /** + * The components that make up a select clause. + * + * @var array + */ + protected $selectComponents = array( + 'aggregate', + 'columns', + 'from', + 'joins', + 'wheres', + 'groups', + 'havings', + 'orders', + 'limit', + 'offset', + ); + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder + * @return string + */ + public function compileSelect(Builder $query) + { + $sql = parent::compileSelect($query); + + if ($query->unions) + { + $sql = '('.$sql.') '.$this->compileUnions($query); + } + + return $sql; + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $joiner = $union['all'] ? ' union all ' : ' union '; + + return $joiner.'('.$union['query']->toSql().')'; + } + /** * Compile an update statement into SQL. *
true
Other
laravel
framework
ea1d3c89311e763d6c78d17325d21f2ad4614c1c.json
Fix MySQL unions with parens.
tests/Database/DatabaseQueryBuilderTest.php
@@ -166,6 +166,12 @@ public function testUnions() $builder->union($this->getBuilder()->select('*')->from('users')->where('id', '=', 2)); $this->assertEquals('select * from "users" where "id" = ? union select * from "users" where "id" = ?', $builder->toSql()); $this->assertEquals(array(0 => 1, 1 => 2), $builder->getBindings()); + + $builder = $this->getMySqlBuilder(); + $builder->select('*')->from('users')->where('id', '=', 1); + $builder->union($this->getMySqlBuilder()->select('*')->from('users')->where('id', '=', 2)); + $this->assertEquals('(select * from `users` where `id` = ?) union (select * from `users` where `id` = ?)', $builder->toSql()); + $this->assertEquals(array(0 => 1, 1 => 2), $builder->getBindings()); }
true
Other
laravel
framework
6089525e1293407085c07588f2eb8b2cd8644b01.json
Simplify the package path guessing.
src/Illuminate/Support/ServiceProvider.php
@@ -105,41 +105,11 @@ public function package($package, $namespace = null, $path = null) */ public function guessPackagePath() { - $reflect = new ReflectionClass($this); - - // We want to get the class that is closest to this base class in the chain of - // classes extending it. That should be the original service provider given - // by the package and should allow us to guess the location of resources. - $chain = $this->getClassChain($reflect); - - $path = $chain[count($chain) - 2]->getFileName(); + $path = with(new ReflectionClass($this))->getFileName(); return realpath(dirname($path).'/../../'); } - /** - * Get a class from the ReflectionClass inheritance chain. - * - * @param ReflectionClass $reflection - * @return array - */ - protected function getClassChain(ReflectionClass $reflect) - { - $classes = array(); - - // This loop essentially walks the inheritance chain of the classes starting - // at the most "childish" class and walks back up to this class. Once we - // get to the end of the chain we will bail out and return the offset. - while ($reflect !== false) - { - $classes[] = $reflect; - - $reflect = $reflect->getParentClass(); - } - - return $classes; - } - /** * Determine the namespace for a package. *
false
Other
laravel
framework
5e88f616e8b75ce5a0e7bd034923d725bc0f5321.json
Add abstract createApplication() method.
src/Illuminate/Foundation/Testing/TestCase.php
@@ -41,6 +41,15 @@ protected function refreshApplication() $this->client = $this->createClient(); } + /** + * Creates the application. + * + * Needs to be implemented by subclasses. + * + * @return Symfony\Component\HttpKernel\HttpKernelInterface + */ + abstract protected function createApplication(); + /** * Call the given URI and return the Response. *
false
Other
laravel
framework
f7e04670b70300f724ecd70377f16173f0c506f6.json
Change visibility of mergeRules.
src/Illuminate/Validation/Validator.php
@@ -197,7 +197,7 @@ public function sometimes($attribute, $rules, $callback) * @param string|array $rules * @return void */ - protected function mergeRules($attribute, $rules) + public function mergeRules($attribute, $rules) { $current = array_get($this->rules, $attribute, array()); @@ -1835,7 +1835,7 @@ public function failed() public function messages() { if ( ! $this->messages) $this->passes(); - + return $this->messages; } @@ -1847,7 +1847,7 @@ public function messages() public function errors() { if ( ! $this->messages) $this->passes(); - + return $this->messages; }
false
Other
laravel
framework
e224e394627f7994be32b19a4ac09822a878ac4f.json
Remove unnecessary SQLite test.
tests/Database/DatabaseQueryBuilderTest.php
@@ -705,14 +705,6 @@ public function testMySqlWrapping() } - public function testSQLiteOrderBy() - { - $builder = $this->getSQLiteBuilder(); - $builder->select('*')->from('users')->orderBy('email', 'desc'); - $this->assertEquals('select * from "users" order by "email" collate nocase desc', $builder->toSql()); - } - - public function testSqlServerLimitsAndOffsets() { $builder = $this->getSqlServerBuilder();
false
Other
laravel
framework
d36c18a3188e2a0be40549731cc79b7275dbccbf.json
Remove special SQLite order by logic.
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
@@ -4,24 +4,6 @@ class SQLiteGrammar extends Grammar { - /** - * Compile the "order by" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $orders - * @return string - */ - protected function compileOrders(Builder $query, $orders) - { - $me = $this; - - return 'order by '.implode(', ', array_map(function($order) use ($me) - { - return $me->wrap($order['column']).' collate nocase '.$order['direction']; - } - , $orders)); - } - /** * Compile an insert statement into SQL. *
false
Other
laravel
framework
a8af94c567113976c24d7361443d1b0d81f55ec3.json
Remove collate nocase on SQLite orders.
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
@@ -17,7 +17,7 @@ protected function compileOrders(Builder $query, $orders) return 'order by '.implode(', ', array_map(function($order) use ($me) { - return $me->wrap($order['column']).' collate nocase '.$order['direction']; + return $me->wrap($order['column']).' '.$order['direction']; } , $orders)); }
true
Other
laravel
framework
a8af94c567113976c24d7361443d1b0d81f55ec3.json
Remove collate nocase on SQLite orders.
tests/Database/DatabaseQueryBuilderTest.php
@@ -714,7 +714,7 @@ public function testSQLiteOrderBy() { $builder = $this->getSQLiteBuilder(); $builder->select('*')->from('users')->orderBy('email', 'desc'); - $this->assertEquals('select * from "users" order by "email" collate nocase desc', $builder->toSql()); + $this->assertEquals('select * from "users" order by "email" desc', $builder->toSql()); }
true
Other
laravel
framework
ea6c72149c67697c84c28c21afedf434d6184842.json
Use bar "or" syntax.
src/Illuminate/Http/Response.php
@@ -94,9 +94,9 @@ protected function morphToJson($content) */ protected function shouldBeJson($content) { - return ($content instanceof JsonableInterface or - $content instanceof ArrayObject or - is_array($content)); + return $content instanceof JsonableInterface || + $content instanceof ArrayObject || + is_array($content); } /**
false
Other
laravel
framework
83f94cf1a0425d2ad526646d743e51ab7f7825a2.json
Increase entropy on session ID generation.
src/Illuminate/Session/Store.php
@@ -149,7 +149,7 @@ public function setId($id) */ protected function generateSessionId() { - return sha1(str_random(25).microtime(true)); + return sha1(uniqid(true).str_random(25).microtime(true)); } /**
false
Other
laravel
framework
fe5fa984b1ebe73cf40e96c0f3acb58718618090.json
Fix some issues with Stack middleware merging.
src/Illuminate/Foundation/Application.php
@@ -561,11 +561,13 @@ protected function getStackedClient() * @param \Stack\Builder * @return void */ - protected function mergeCustomMiddlewares($stack) + protected function mergeCustomMiddlewares(\Stack\Builder $stack) { - foreach ($this->middlewares as $key => $value) + foreach ($this->middlewares as $middleware) { - $parameters = array_unshift($value, $key); + list($class, $parameters) = $middleware; + + $parameters = array_unshift($parameters, $class); call_user_func_array(array($stack, 'push'), $parameters); } @@ -580,7 +582,7 @@ protected function mergeCustomMiddlewares($stack) */ public function middleware($class, array $parameters = array()) { - $this->middlewares[$class] = $parameters; + $this->middlewares[] = compact('class', 'parameters'); return $this; }
false
Other
laravel
framework
187e239aede4d443827d9de77105d1d137a8e053.json
Fix bug in type hint.
src/Illuminate/Foundation/Application.php
@@ -558,16 +558,16 @@ protected function getStackedClient() /** * Merge the developer defined middlewares onto the stack. * - * @param \Symfony\Component\HttpKernel\HttpKernelInterface + * @param \Stack\Builder * @return void */ - protected function mergeCustomMiddlewares(HttpKernelInterface $client) + protected function mergeCustomMiddlewares($stack) { foreach ($this->middlewares as $key => $value) { $parameters = array_unshift($value, $key); - call_user_func_array(array($client, 'push'), $parameters); + call_user_func_array(array($stack, 'push'), $parameters); } }
false
Other
laravel
framework
d73fbbc7be29c584ed5545c8d6f673ef84584a6b.json
Bind container into itself.
src/Illuminate/Foundation/Application.php
@@ -116,6 +116,8 @@ public function __construct(Request $request = null) $this->instance('request', $request = Request::createFromGlobals()); $this->registerBaseServiceProviders(); + + $this->instance('Illuminate\Container\Container', $this); } /**
false
Other
laravel
framework
6bbfa3bf5a698e75bc2f417a44fe63eefd038ba6.json
Change the name of the Tags class to TagSet
src/Illuminate/Cache/TagSet.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Cache; -class Tags { +class TagSet { /** * The cache store implementation. @@ -17,7 +17,7 @@ class Tags { protected $names = array(); /** - * Create a new tags instance. + * Create a new TagSet instance. * * @param \Illuminate\Cache\StoreInterface $store * @param string $names
true
Other
laravel
framework
6bbfa3bf5a698e75bc2f417a44fe63eefd038ba6.json
Change the name of the Tags class to TagSet
src/Illuminate/Cache/TaggedCache.php
@@ -27,7 +27,7 @@ class TaggedCache implements StoreInterface { */ public function __construct(StoreInterface $store, $names) { - $this->tags = new Tags($store, $names); + $this->tags = new TagSet($store, $names); $this->store = $store; }
true
Other
laravel
framework
04f1c04afea8a7fc733e305e33e05411dc316399.json
Fix a few request bugs.
src/Illuminate/Foundation/Application.php
@@ -543,14 +543,16 @@ public function booted($callback) * @param \Symfony\Component\HttpFoundation\Request $request * @return void */ - public function run(SymfonyRequest $request) + public function run(SymfonyRequest $request = null) { + $request = $request ?: $this['request']; + $response = with(new \Stack\Builder) ->push('Illuminate\Cookie\Guard', $this['encrypter']) ->push('Illuminate\Cookie\Queue', $this['cookie']) ->push('Illuminate\Session\Middleware', $this['session']) ->resolve($this) - ->handle($this['request']); + ->handle($request); $this->callCloseCallbacks($request, $response);
false
Other
laravel
framework
f07272015670d3296bb8d1aa0571ce55d63a638f.json
Bind request on constructor.
src/Illuminate/Foundation/Application.php
@@ -108,14 +108,12 @@ class Application extends Container implements HttpKernelInterface, TerminableIn /** * Create a new Illuminate application instance. * + * @param \Illuminate\Http\Request $request * @return void */ - public function __construct() + public function __construct(Request $request = null) { - $this['request'] = function() - { - throw new \Exception("Using request outside of scope. Try moving call to before handler or route."); - }; + $this->instance('request', $request ?: Request::createFromGlobals()); $this->registerBaseServiceProviders(); } @@ -562,7 +560,7 @@ public function run(SymfonyRequest $request) ->push('Illuminate\Cookie\Queue', $this['cookie']) ->push('Illuminate\Session\Middleware', $this['session']) ->resolve($this) - ->handle($request); + ->handle($this['request']); $this->callCloseCallbacks($request, $response);
false
Other
laravel
framework
306810528329467771653c81a2f984ae80956290.json
Set the app key in the config after updating it
src/Illuminate/Foundation/Console/KeyGenerateCommand.php
@@ -48,6 +48,8 @@ public function fire() $this->files->put($path, $contents); + $this->laravel['config']['app.key'] = $key; + $this->info("Application key [$key] set successfully."); }
false
Other
laravel
framework
aaf6d5b393beffacadd0dc1951c952c7bf116c8e.json
Fix resource path.
src/Illuminate/Exception/ExceptionServiceProvider.php
@@ -137,7 +137,7 @@ protected function shouldReturnJson() protected function registerPrettyWhoopsHandler() { $me = $this; - + $this->app['whoops.handler'] = $this->app->share(function() use ($me) { with($handler = new PrettyPageHandler)->setEditor('sublime'); @@ -171,7 +171,9 @@ public function resourcePath() */ protected function getResourcePath() { - return __DIR__.'/resources'; + $base = $this->app['path.base']; + + return $base.'/vendor/laravel/framework/src/Illuminate/Exception/resources'; } }
false
Other
laravel
framework
3b6da655655c08bbb513f511461bcb1b40eb8d57.json
Use null session handler.
src/Illuminate/Session/SessionManager.php
@@ -4,6 +4,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; class SessionManager extends Manager { @@ -26,7 +27,7 @@ protected function callCustomCreator($driver) */ protected function createArrayDriver() { - return new Store(new MockArraySessionStorage); + return new Store($this->app['config']['session.cookie'], new NullSessionHandler); } /**
false
Other
laravel
framework
9ecfb90b86e46f9fc2f488cb6637349173f3de09.json
Add stack/builder to composer.
composer.json
@@ -21,6 +21,7 @@ "patchwork/utf8": "1.1.*", "phpseclib/phpseclib": "0.3.*", "predis/predis": "0.8.*", + "stack/builder": "1.0.*", "swiftmailer/swiftmailer": "5.0.*", "symfony/browser-kit": "2.4.*", "symfony/console": "2.4.*",
false
Other
laravel
framework
4206a2cf7d9adb700fc0ba549029f454a0e8ca32.json
Move trailing slash redirection into middleware.
src/Illuminate/Foundation/Application.php
@@ -159,60 +159,6 @@ protected function registerEventProvider() $this->register(new EventServiceProvider($this)); } - /** - * Create the request for the application. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Request - */ - protected function createRequest(Request $request = null) - { - return $request ?: static::onRequest('createFromGlobals'); - } - - /** - * Redirect the request if it has a trailing slash. - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse|null - */ - public function redirectIfTrailingSlash() - { - if ($this->runningInConsole()) return; - - // Here we will check if the request path ends in a single trailing slash and - // redirect it using a 301 response code if it does which avoids duplicate - // content in this application while still providing a solid experience. - $path = $this['request']->getPathInfo(); - - if ($this->hasTrailingSlash($path)) - { - $this->redirectWithoutSlash(); - } - } - - /** - * Determine if the given path has a trailing slash. - * - * @param string $path - * @return string - */ - protected function hasTrailingSlash($path) - { - return ($path != '/' and ends_with($path, '/') and ! ends_with($path, '//')); - } - - /** - * Send a redirect response without the trailing slash. - * - * @return void - */ - protected function redirectWithoutSlash() - { - with(new SymfonyRedirect($this['request']->fullUrl(), 301))->send(); - - exit; - } - /** * Bind the installation paths to the application. *
true
Other
laravel
framework
4206a2cf7d9adb700fc0ba549029f454a0e8ca32.json
Move trailing slash redirection into middleware.
src/Illuminate/Foundation/TrailingSlashRedirector.php
@@ -0,0 +1,97 @@ +<?php namespace Illuminate\Foundation; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; + +class TrailingSlashRedirector implements HttpKernelInterface { + + /** + * The wrapped HttpKernel. + * + * @var \Symfony\Component\HttpKernel\HttpKernelInterface + */ + protected $app; + + /** + * Create a new instance of the middleware. + * + * @param \Symfony\Component\HttpKernel\HttpKernelInterface + * @return void + */ + public function __construct(HttpKernelInterface $app) + { + $this->app = $app; + } + + /** + * Handle an incoming request and convert it to a response. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param int $type + * @param bool $catch + * @return \Symfony\Component\HttpFoundation\Response + */ + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + { + if ($this->runningInConsole()) return; + + // Here we will check if the request path ends in a single trailing slash and + // redirect it using a 301 response code if it does which avoids duplicate + // content in this application while still providing a solid experience. + if ($this->hasTrailingSlash($request->getPathInfo())) + { + return $this->redirectWithoutSlash($request); + } + + return $this->app->handle($request, $type, $catch); + } + + /** + * Determine if the given path has a trailing slash. + * + * @param string $path + * @return string + */ + protected function hasTrailingSlash($path) + { + return ($path != '/' and ends_with($path, '/') and ! ends_with($path, '//')); + } + + /** + * Send a redirect response without the trailing slash. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + protected function redirectWithoutSlash(Request $request) + { + return new RedirectResponse($this->fullUrl($request), 301); + } + + /** + * Get the full URL for the request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return string + */ + protected function fullUrl(Request $request) + { + $query = $request->getQueryString(); + + $url = rtrim(preg_replace('/\?.*/', '', $request->getUri()), '/'); + + return $query ? $url.'?'.$query : $url; + } + + /** + * Determine if we are running in a console. + * + * @return bool + */ + protected function runningInConsole() + { + return php_sapi_name() == 'cli'; + } + +} \ No newline at end of file
true
Other
laravel
framework
ad32f992fb9c01fec8df01cab24353e2d1ae137f.json
Fix a few request bugs.
src/Illuminate/Exception/ExceptionServiceProvider.php
@@ -126,7 +126,7 @@ protected function shouldReturnJson() { if ($this->app->runningInConsole()) return true; - return $app->isBooted() and $this->requestWantsJson(); + return $this->app->isBooted() and $this->requestWantsJson(); } /**
true
Other
laravel
framework
ad32f992fb9c01fec8df01cab24353e2d1ae137f.json
Fix a few request bugs.
src/Illuminate/Foundation/Application.php
@@ -300,9 +300,9 @@ public function isLocal() */ public function detectEnvironment($envs) { - $this['env'] = with(new EnvironmentDetector())->detect($envs, $_SERVER['argv']); + $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null; - return $this['env']; + return $this['env'] = with(new EnvironmentDetector())->detect($envs, $args); } /**
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
src/Illuminate/Console/Application.php
@@ -27,6 +27,11 @@ class Application extends \Symfony\Component\Console\Application { */ public static function start($app) { + // Here, we will go ahead and "boot" the application for usage. This simply + // calls the boot method on all of the service providers so they get all + // their work done and are ready to handle interacting with dev input. + $app->boot(); + $artisan = require __DIR__.'/start.php'; $artisan->setAutoExit(false);
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
src/Illuminate/Exception/ExceptionServiceProvider.php
@@ -124,9 +124,19 @@ protected function registerWhoopsHandler() */ protected function shouldReturnJson() { - $definitely = ($this->app['request']->ajax() or $this->app->runningInConsole()); + if ($this->app->runningInConsole()) return true; - return $definitely or $this->app['request']->wantsJson(); + return $app->isBooted() and $this->requestWantsJson(); + } + + /** + * Determine if the request warrants a JSON response. + * + * @return bool + */ + protected function requestWantsJson() + { + return $this->app['request']->ajax() or $this->app['request']->wantsJson(); } /**
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
src/Illuminate/Foundation/Application.php
@@ -16,6 +16,7 @@ use Illuminate\Exception\ExceptionServiceProvider; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\TerminableInterface; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Debug\Exception\FatalErrorException; @@ -25,7 +26,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect; -class Application extends Container implements HttpKernelInterface, ResponsePreparerInterface { +class Application extends Container implements HttpKernelInterface, TerminableInterface, ResponsePreparerInterface { /** * The Laravel framework version. @@ -112,8 +113,6 @@ class Application extends Container implements HttpKernelInterface, ResponsePrep */ public function __construct(Request $request = null) { - $this['request'] = $this->createRequest($request); - $this->registerBaseServiceProviders(); } @@ -296,16 +295,12 @@ public function isLocal() /** * Detect the application's current environment. * - * @param array|string $environments + * @param array|string $envs * @return string */ - public function detectEnvironment($environments) + public function detectEnvironment($envs) { - $this['env'] = with(new EnvironmentDetector($this['request']))->detect( - - $environments, $this->runningInConsole() - - ); + $this['env'] = with(new EnvironmentDetector())->detect($envs, $_SERVER['argv']); return $this['env']; } @@ -495,14 +490,21 @@ public function after($callback) } /** - * Register a "close" application filter. + * Register a "close" application callback, or call them. * * @param Closure|string $callback * @return void */ - public function close($callback) + public function close($callback = null) { - $this->closeCallbacks[] = $callback; + if (is_null($callback)) + { + $this->callCloseCallbacks(); + } + else + { + $this->closeCallbacks[] = $callback; + } } /** @@ -534,6 +536,16 @@ public function shutdown($callback = null) } } + /** + * Determine if the application has booted. + * + * @return bool + */ + public function isBooted() + { + return $this->booted; + } + /** * Boot the application's service providers. * @@ -615,6 +627,8 @@ public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MAS { $this->refreshRequest($request = Request::createFromBase($request)); + $this->boot(); + return $this->dispatch($request); } @@ -645,11 +659,9 @@ public function dispatch(Request $request) */ public function terminate(SymfonyRequest $request, SymfonyResponse $response) { - $this->callCloseCallbacks($request, $response); - - $response->send(); - $this->callFinishCallbacks($request, $response); + + $this->shutdown(); } /**
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
src/Illuminate/Foundation/EnvironmentDetector.php
@@ -1,40 +1,21 @@ <?php namespace Illuminate\Foundation; use Closure; -use Illuminate\Http\Request; class EnvironmentDetector { - /** - * The request instance. - * - * @var \Illuminate\Http\Request - */ - protected $request; - - /** - * Create a new environment detector instance. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - public function __construct(Request $request) - { - $this->request = $request; - } - /** * Detect the application's current environment. * * @param array|string $environments - * @param bool $inConsole + * @param array|null $consoleArgs * @return string */ - public function detect($environments, $inConsole = false) + public function detect($environments, $consoleArgs = null) { - if ($inConsole) + if ($consoleArgs) { - return $this->detectConsoleEnvironment($environments); + return $this->detectConsoleEnvironment($environments, $consoleArgs); } else { @@ -58,19 +39,14 @@ protected function detectWebEnvironment($environments) return call_user_func($environments); } - $webHost = $this->getHost(); - foreach ($environments as $environment => $hosts) { // To determine the current environment, we'll simply iterate through the possible // environments and look for the host that matches the host for this request we // are currently processing here, then return back these environment's names. foreach ((array) $hosts as $host) { - if (str_is($host, $webHost) or $this->isMachine($host)) - { - return $environment; - } + if ($this->isMachine($host)) return $environment; } } @@ -81,14 +57,15 @@ protected function detectWebEnvironment($environments) * Set the application environment from command-line arguments. * * @param mixed $environments + * @param array $args * @return string */ - protected function detectConsoleEnvironment($environments) + protected function detectConsoleEnvironment($environments, array $args) { // First we will check if an environment argument was passed via console arguments // and if it was that automatically overrides as the environment. Otherwise, we // will check the environment as a "web" request like a typical HTTP request. - if ( ! is_null($value = $this->getEnvironmentArgument())) + if ( ! is_null($value = $this->getEnvironmentArgument($args))) { return head(array_slice(explode('=', $value), 1)); } @@ -101,43 +78,24 @@ protected function detectConsoleEnvironment($environments) /** * Get the enviornment argument from the console. * + * @param array $args * @return string|null */ - protected function getEnvironmentArgument() + protected function getEnvironmentArgument(array $args) { - return array_first($this->getConsoleArguments(), function($k, $v) + return array_first($args, function($k, $v) { return starts_with($v, '--env'); }); } - /** - * Get the actual host for the web request. - * - * @return string - */ - protected function getHost() - { - return $this->request->getHost(); - } - - /** - * Get the server console arguments. - * - * @return array - */ - protected function getConsoleArguments() - { - return $this->request->server->get('argv'); - } - /** * Determine if the name matches the machine name. * * @param string $name * @return bool */ - protected function isMachine($name) + public function isMachine($name) { return str_is($name, gethostname()); }
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
src/Illuminate/Foundation/start.php
@@ -26,7 +26,7 @@ if ( ! extension_loaded('mcrypt')) { - echo 'Laravel requires the Mcrypt PHP extension.'.PHP_EOL; + echo 'Mcrypt PHP extension required.'.PHP_EOL; exit(1); } @@ -103,9 +103,11 @@ | */ -$config = new Config($app->getConfigLoader(), $env); +$app->instance('config', $config = new Config( -$app->instance('config', $config); + $app->getConfigLoader(), $env + +)); /* |-------------------------------------------------------------------------- @@ -148,7 +150,9 @@ | */ -AliasLoader::getInstance($config['aliases'])->register(); +$aliases = $config['aliases']; + +AliasLoader::getInstance($aliases)->register(); /* |-------------------------------------------------------------------------- @@ -163,22 +167,6 @@ Request::enableHttpMethodParameterOverride(); -/* -|-------------------------------------------------------------------------- -| Set The Console Request If Necessary -|-------------------------------------------------------------------------- -| -| If we're running in a console context, we won't have a host on this -| request so we'll need to re-bind a new request with a URL from a -| configuration file. This will help the URL generator generate. -| -*/ - -if ($app->runningInConsole()) -{ - $app->setRequestForConsoleEnvironment(); -} - /* |-------------------------------------------------------------------------- | Register The Core Service Providers @@ -194,19 +182,6 @@ $app->getProviderRepository()->load($app, $providers); -/* -|-------------------------------------------------------------------------- -| Boot The Application -|-------------------------------------------------------------------------- -| -| Before we handle the requests we need to make sure the application has -| been booted up. The boot process will call the "boot" method on all -| service provider giving all a chance to register their overrides. -| -*/ - -$app->boot(); - /* |-------------------------------------------------------------------------- | Load The Application Start Script @@ -248,7 +223,6 @@ | */ -if (file_exists($path = $app['path'].'/routes.php')) -{ - require $path; -} \ No newline at end of file +$routes = $app['path'].'/routes.php'; + +if (file_exists($routes)) require $routes;
true
Other
laravel
framework
02618b4190c08e1fe6e138eadb95473c92da6718.json
Continue work on StackPHP compatibility.
tests/Foundation/FoundationEnvironmentDetectorTest.php
@@ -12,54 +12,26 @@ public function tearDown() public function testEnvironmentDetection() { - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('foo'); - $request->server = m::mock('StdClass'); - $env = new Illuminate\Foundation\EnvironmentDetector($request); - + $env = m::mock('Illuminate\Foundation\EnvironmentDetector')->makePartial(); + $env->shouldReceive('isMachine')->once()->with('localhost')->andReturn(false); $result = $env->detect(array( 'local' => array('localhost') )); $this->assertEquals('production', $result); - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('localhost'); - $request->server = m::mock('StdClass'); - $env = new Illuminate\Foundation\EnvironmentDetector($request); + $env = m::mock('Illuminate\Foundation\EnvironmentDetector')->makePartial(); + $env->shouldReceive('isMachine')->once()->with('localhost')->andReturn(true); $result = $env->detect(array( 'local' => array('localhost') )); $this->assertEquals('local', $result); - - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('localhost'); - $request->server = m::mock('StdClass'); - $env = new Illuminate\Foundation\EnvironmentDetector($request); - - $result = $env->detect(array( - 'local' => array('local*') - )); - $this->assertEquals('local', $result); - - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('localhost'); - $request->server = m::mock('StdClass'); - $env = new Illuminate\Foundation\EnvironmentDetector($request); - - $result = $env->detect(array( - 'local' => array(gethostname()) - )); - $this->assertEquals('local', $result); } public function testClosureCanBeUsedForCustomEnvironmentDetection() { - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('foo'); - $request->server = m::mock('StdClass'); - $env = new Illuminate\Foundation\EnvironmentDetector($request); + $env = new Illuminate\Foundation\EnvironmentDetector; $result = $env->detect(function() { return 'foobar'; }); $this->assertEquals('foobar', $result); @@ -68,15 +40,11 @@ public function testClosureCanBeUsedForCustomEnvironmentDetection() public function testConsoleEnvironmentDetection() { - $request = m::mock('Illuminate\Http\Request'); - $request->shouldReceive('getHost')->andReturn('foo'); - $request->server = m::mock('StdClass'); - $request->server->shouldReceive('get')->once()->with('argv')->andReturn(array('--env=local')); - $env = new Illuminate\Foundation\EnvironmentDetector($request); + $env = new Illuminate\Foundation\EnvironmentDetector; $result = $env->detect(array( 'local' => array('foobar') - ), true); + ), array('--env=local')); $this->assertEquals('local', $result); }
true
Other
laravel
framework
d9da4dac225ba4dc1fb0f96127e36e259a59dfed.json
Fix bugs and write tests.
src/Illuminate/Cache/Repository.php
@@ -1,8 +1,8 @@ <?php namespace Illuminate\Cache; use Closure; -use ArrayAccess; use DateTime; +use ArrayAccess; use Carbon\Carbon; class Repository implements ArrayAccess { @@ -52,7 +52,7 @@ public function has($key) public function get($key, $default = null) { $value = $this->store->get($key); - + return ! is_null($value) ? $value : value($default); } @@ -138,7 +138,7 @@ public function rememberForever($key, Closure $callback) $this->forever($key, $value = $callback()); - return $value; + return $value; } /** @@ -232,7 +232,7 @@ protected function getMinutes($duration) if ($duration instanceof Carbon) { - return max(0, Carbon::now()->diffInMinutes(false)); + return max(0, Carbon::now()->diffInMinutes($duration, false)); } else {
true
Other
laravel
framework
d9da4dac225ba4dc1fb0f96127e36e259a59dfed.json
Fix bugs and write tests.
src/Illuminate/Cache/composer.json
@@ -9,15 +9,15 @@ ], "require": { "php": ">=5.3.0", - "illuminate/support": "4.1.x", + "illuminate/support": "4.1.*", "nesbot/carbon": "1.*" }, "require-dev": { "phpunit/phpunit": "3.7.*", - "illuminate/database": "4.1.x", - "illuminate/encryption": "4.1.x", - "illuminate/filesystem": "4.1.x", - "illuminate/redis": "4.1.x" + "illuminate/database": "4.1.*", + "illuminate/encryption": "4.1.*", + "illuminate/filesystem": "4.1.*", + "illuminate/redis": "4.1.*" }, "autoload": { "psr-0": {"Illuminate\\Cache": ""}
true
Other
laravel
framework
d9da4dac225ba4dc1fb0f96127e36e259a59dfed.json
Fix bugs and write tests.
tests/Cache/CacheRepositoryTest.php
@@ -54,6 +54,15 @@ public function testRememberMethodCallsPutAndReturnsDefault() $repo->getStore()->shouldReceive('put')->once()->with('foo', 'bar', 10); $result = $repo->remember('foo', 10, function() { return 'bar'; }); $this->assertEquals('bar', $result); + + /** + * Use Carbon object... + */ + $repo = $this->getRepository(); + $repo->getStore()->shouldReceive('get')->andReturn(null); + $repo->getStore()->shouldReceive('put')->once()->with('foo', 'bar', 10); + $result = $repo->remember('foo', Carbon\Carbon::now()->addMinutes(10), function() { return 'bar'; }); + $this->assertEquals('bar', $result); }
true
Other
laravel
framework
d1175f90de7f541468c90661dc363b424fd7decd.json
Add tests for rebinding event.
tests/Container/ContainerTest.php
@@ -213,6 +213,32 @@ public function testUnsetRemoveBoundInstances() $this->assertFalse($container->bound('object')); } + + public function testReboundListeners() + { + unset($_SERVER['__test.rebind']); + + $container = new Container; + $container->bind('foo', function() {}); + $container->rebinding('foo', function() { $_SERVER['__test.rebind'] = true; }); + $container->bind('foo', function() {}); + + $this->assertTrue($_SERVER['__test.rebind']); + } + + + public function testReboundListenersOnInstances() + { + unset($_SERVER['__test.rebind']); + + $container = new Container; + $container->instance('foo', function() {}); + $container->rebinding('foo', function() { $_SERVER['__test.rebind'] = true; }); + $container->instance('foo', function() {}); + + $this->assertTrue($_SERVER['__test.rebind']); + } + } class ContainerConcreteStub {}
false
Other
laravel
framework
71f3e62aa8bd580c19087ef51517b933dcf6472b.json
Add missing methods and tests.
src/Illuminate/Routing/Router.php
@@ -1356,6 +1356,30 @@ public function current() return $this->current; } + /** + * Determine if the current route matches a given name. + * + * @param string $name + * @return bool + */ + public function currentRouteNamed($name) + { + return $this->current()->getName() == $name; + } + + /** + * Determine if the current route action matches a given action. + * + * @param string $action + * @return bool + */ + public function currentRouteUses($action) + { + $current = $this->current()->getAction(); + + return isset($current['controller']) && $current['controller'] == $action; + } + /** * Get the request currently being dispatched. *
true
Other
laravel
framework
71f3e62aa8bd580c19087ef51517b933dcf6472b.json
Add missing methods and tests.
tests/Routing/RoutingRouteTest.php
@@ -40,10 +40,11 @@ public function testBasicDispatchingOfRoutes() $this->assertEquals('30', $router->dispatch(Request::create('30', 'GET'))->getContent()); $router = $this->getRouter(); - $router->get('{foo?}/{baz?}', function($name = 'taylor', $age = 25) { return $name.$age; }); + $router->get('{foo?}/{baz?}', array('as' => 'foo', function($name = 'taylor', $age = 25) { return $name.$age; })); $this->assertEquals('taylor25', $router->dispatch(Request::create('/', 'GET'))->getContent()); $this->assertEquals('fred25', $router->dispatch(Request::create('fred', 'GET'))->getContent()); $this->assertEquals('fred30', $router->dispatch(Request::create('fred/30', 'GET'))->getContent()); + $this->assertTrue($router->currentRouteNamed('foo')); } @@ -84,6 +85,8 @@ public function testDispatchingOfControllers() $router->disableFilters(); $router->get('bar', 'RouteTestControllerDispatchStub@bar'); $this->assertEquals('baz', $router->dispatch(Request::create('bar', 'GET'))->getContent()); + + $this->assertTrue($router->currentRouteUses('RouteTestControllerDispatchStub@bar')); }
true
Other
laravel
framework
0f7c230eb3f792d8f8ccd35807f04967854e485a.json
Remove unneeded variable.
src/Illuminate/Remote/RemoteManager.php
@@ -110,7 +110,7 @@ protected function makeConnection($name, array $config) { $this->setOutput($connection = new Connection( - $name, $config['host'], $config['username'], $this->getAuth($config), $keyphrase + $name, $config['host'], $config['username'], $this->getAuth($config) ));
false
Other
laravel
framework
2613aacd2ea7ea9c24892effae061d343e43a535.json
Check warning count on date format.
src/Illuminate/Validation/Validator.php
@@ -1028,7 +1028,7 @@ protected function validateDateFormat($attribute, $value, $parameters) { $parsed = date_parse_from_format($parameters[0], $value); - return $parsed['error_count'] === 0; + return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; } /**
false
Other
laravel
framework
f3ef1653f6f82e2af9c2682a7584d932b974fadd.json
Prepare response from router.
src/Illuminate/Routing/Router.php
@@ -912,7 +912,7 @@ public function dispatch(Request $request) $response = $this->dispatchToRoute($request); } - $response = $this->prepareResponse($response); + $response = $this->prepareResponse($request, $response); // Once this route has run and the response has been prepared, we will run the // after filter to do any last work on the response or for this application @@ -942,7 +942,7 @@ public function dispatchToRoute(Request $request) $response = $route->run($request); } - $response = $this->prepareResponse($response); + $response = $this->prepareResponse($request, $response); // After we have a prepared response from the route or filter we will call to // the "after" filters to do any last minute processing on this request or @@ -1285,17 +1285,18 @@ public function callRouteFilter($filter, $parameters, $route, $request, $respons /** * Create a response instance from the given value. * + * @param \Symfony\Component\HttpFoundation\Request $request * @param mixed $response * @return \Illuminate\Http\Response */ - protected function prepareResponse($response) + protected function prepareResponse($request, $response) { if ( ! $response instanceof SymfonyResponse) { $response = new Response($response); } - return $response; + return $response->prepare($request); } /**
false
Other
laravel
framework
f62d1a727155073357babee95a8f679003a8b93c.json
Consolidate "live" debug into tail command.
composer.json
@@ -21,7 +21,6 @@ "patchwork/utf8": "1.1.*", "phpseclib/phpseclib": "0.3.*", "predis/predis": "0.8.*", - "react/socket": "0.3.*", "swiftmailer/swiftmailer": "5.0.*", "symfony/browser-kit": "2.4.*", "symfony/console": "2.4.*",
true
Other
laravel
framework
f62d1a727155073357babee95a8f679003a8b93c.json
Consolidate "live" debug into tail command.
src/Illuminate/Exception/Console/DebugCommand.php
@@ -1,78 +0,0 @@ -<?php namespace Illuminate\Exception\Console; - -use Closure; -use Illuminate\Console\Command; -use React\Socket\Server as SocketServer; -use React\EventLoop\Factory as LoopFactory; - -class DebugCommand extends Command { - - /** - * The console command name. - * - * @var string - */ - protected $name = 'debug'; - - /** - * The console command description. - * - * @var string - */ - protected $description = "Start a live debug console"; - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $loop = LoopFactory::create(); - - // Once we have an event loop instance, we will configure the socket so that it - // is ready for receiving incoming messages on a given port for the host box - // that we are currently on. We will then start up the event loop finally. - $this->configureSocket(new SocketServer($loop)); - - $this->info('Live debugger started...'); $loop->run(); - } - - /** - * Configure the given socket server. - * - * @param \React\Socket\Server $socket - * @param \Closure $callback - * @return void - */ - protected function configureSocket($socket) - { - $output = $this->output; - - // Here we will pass the callback that will handle incoming data to the console - // and we can log it out however we want. We will just write it out using an - // implementation of a consoles OutputInterface which should perform fine. - $this->onIncoming($socket, function($data) use ($output) - { - $output->write($data); - }); - - $socket->listen(8337, '127.0.0.1'); - } - - /** - * Register a callback for incoming data. - * - * @param \React\Socket\Server $socket - * @param \Closure $callback - * @return void - */ - protected function onIncoming($socket, Closure $callback) - { - $socket->on('connection', function($conn) use ($callback) - { - $conn->on('data', $callback); - }); - } - -} \ No newline at end of file
true
Other
laravel
framework
f62d1a727155073357babee95a8f679003a8b93c.json
Consolidate "live" debug into tail command.
src/Illuminate/Exception/LiveServiceProvider.php
@@ -1,151 +0,0 @@ -<?php namespace Illuminate\Exception; - -use Monolog\Handler\SocketHandler; -use Illuminate\Support\ServiceProvider; - -class LiveServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerCommand(); - } - - /** - * Bootstrap the application events. - * - * @return void - */ - public function boot() - { - if ($this->registerMonologHandler()) $this->registerEvents(); - } - - /** - * Register the live debugger events. - * - * @return void - */ - protected function registerEvents() - { - $monolog = $this->app['log']->getMonolog(); - - foreach (array('Request', 'Database') as $event) - { - $this->{"register{$event}Logger"}($monolog); - } - } - - /** - * Register the live debugger console command. - * - * @return void - */ - protected function registerCommand() - { - $this->app['command.debug'] = $this->app->share(function($app) - { - return new Console\DebugCommand; - }); - - $this->commands('command.debug'); - } - - /** - * Register the request logger event. - * - * @param \Monolog\Logger $monolog - * @return void - */ - protected function registerRequestLogger($monolog) - { - $this->app->before(function($request) use ($monolog) - { - $monolog->addInfo('<info>'.strtolower($request->getMethod()).' '.$request->path().'</info>'); - }); - } - - /** - * Register the database query listener. - * - * @param \Monolog\Logger $monolog - * @return void - */ - protected function registerDatabaseLogger($monolog) - { - $this->app['events']->listen('illuminate.query', function($sql, $bindings, $time) use ($monolog) - { - $sql = str_replace_array('\?', $bindings, $sql); - - $monolog->addInfo('<comment>'.$sql.' ['.$time.'ms]</comment>'); - }); - } - - /** - * Register Monolog handler and establish the connection. - * - * @return bool - */ - protected function registerMonologHandler() - { - $this->addSocketHandler(); - - return $this->establishConnection($this->app['log']->getMonolog()); - } - - /** - * Add the socket handler onto the Monolog stack. - * - * @return void - */ - protected function addSocketHandler() - { - $monolog = $this->app['log']->getMonolog(); - - $monolog->pushHandler(new SocketHandler('tcp://127.0.0.1:8337')); - } - - /** - * Attempt to establish the socket handler connection. - * - * @param \Monolog\Logger $monolog - * @return bool - */ - protected function establishConnection($monolog) - { - try - { - $monolog->addInfo('Debug client connecting...'); - } - catch (\Exception $e) - { - $monolog->popHandler(); - - return false; - } - - return true; - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('command.debug'); - } - -} \ No newline at end of file
true
Other
laravel
framework
f62d1a727155073357babee95a8f679003a8b93c.json
Consolidate "live" debug into tail command.
src/Illuminate/Foundation/Console/TailCommand.php
@@ -1,6 +1,7 @@ <?php namespace Illuminate\Foundation\Console; use Illuminate\Console\Command; +use Symfony\Component\Process\Process; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; @@ -27,43 +28,118 @@ class TailCommand extends Command { */ public function fire() { - $path = $this->getPath(); + $path = $this->getPath($this->argument('connection')); if ($path) { - $output = $this->output; - - $this->getConnection()->run('tail -f '.$path, function($line) use ($output) - { - $output->write($line); - }); + $this->tailLogFile($path, $this->argument('connection')); } else { $this->error('Could not determine path to log file.'); } } + /** + * Tail the given log file for the connection. + * + * @param string $path + * @param string $connection + * @return void + */ + protected function tailLogFile($path, $connection) + { + if (is_null($connection)) + { + $this->tailLocalLogs($path); + } + else + { + $this->tailRemoteLogs($path, $connection); + } + } + + /** + * Tail a local log file for the application. + * + * @param string $path + * @return string + */ + protected function tailLocalLogs($path) + { + $this->registerQueryLogger(); + + $output = $this->output; + + with(new Process('tail -f '.$path))->run(function($type, $line) use ($output) + { + $output->write($line); + }); + } + + /** + * Register a query logger for local tailing convenience. + * + * @return void + */ + protected function registerQueryLogger() + { + $app = $this->laravel; + + $this->laravel['db']->listen(function($sql, $bindings, $time) use ($app) + { + $sql = str_replace_array('\?', $bindings, $sql); + + $app['log']->debug($sql.' ['.$time.'ms]'); + }); + } + + /** + * Tail a remote log file at the given path and connection. + * + * @param string $path + * @param string $connection + * @return void + */ + protected function tailRemoteLogs($path, $connection) + { + $out = $this->output; + + $this->getRemote($connection)->run('tail -f '.$path, function($line) use ($out) + { + $out->write($line); + }); + } + /** * Get a connection to the remote server. * + * @param string $connection * @return \Illuminate\Remote\Connection */ - protected function getConnection() + protected function getRemote($connection) { - return $this->laravel['remote']->connection($this->argument('connection')); + return $this->laravel['remote']->connection($connection); } /** * Get the path to the Laraevl log file. * + * @param string $connection * @return string */ - protected function getPath() + protected function getPath($connection) { if ($this->option('path')) return $this->option('path'); - return $this->getRoot($this->argument('connection')).'/app/storage/logs/laravel.log'; + if (is_null($connection)) + { + return base_path().'/app/storage/logs/laravel.log'; + } + else + { + return $this->getRoot($connection).'/app/storage/logs/laravel.log'; + } } /** @@ -85,7 +161,7 @@ protected function getRoot($connection) protected function getArguments() { return array( - array('connection', InputArgument::REQUIRED, 'The remote connection name'), + array('connection', InputArgument::OPTIONAL, 'The remote connection name'), ); }
true
Other
laravel
framework
9e854f731cbe67b489630ef509d660bc5b0620d2.json
Fix various bugs with TailCommand.
src/Illuminate/Foundation/Console/TailCommand.php
@@ -31,9 +31,11 @@ public function fire() if ($path) { - $this->getConnection()->run('tail -f '.$path, function($out) + $output = $this->output; + + $this->getConnection()->run('tail -f '.$path, function($line) use ($output) { - $this->line($out); + $output->write($line); }); } else
false
Other
laravel
framework
c0efbe169bf9840e9629ae0351a2eff7b62a3feb.json
Fix Filesystem prepend when file doesn't exist
src/Illuminate/Filesystem/Filesystem.php
@@ -93,7 +93,7 @@ public function prepend($path, $data) } else { - return $this->put($data); + return $this->put($path, $data); } }
false
Other
laravel
framework
cf51536b79a8b66d32ad11ad89a3d22acc47351b.json
fix merge conflicts.
src/Illuminate/Foundation/Application.php
@@ -230,13 +230,21 @@ public function attachDebugger() } /** - * Get the current application environment. + * Get or check the current application environment. * + * @param dynamic * @return string */ public function environment() { - return $this['env']; + if (count(func_get_args()) > 0) + { + return in_array($this['env'], func_get_args()); + } + else + { + return $this['env']; + } } /**
true
Other
laravel
framework
cf51536b79a8b66d32ad11ad89a3d22acc47351b.json
fix merge conflicts.
src/Illuminate/Foundation/changes.json
@@ -77,6 +77,7 @@ {"message": "Allow Blade processing on echos to be escaped using the @ sign.", "backport": null}, {"message": "Allow custom messages to be registered when using Validator::extend.", "backport": null}, {"message": "Added new auth:clear-reminders command for clearing expired password reminders.", "backport": null}, - {"message": "Added Cookie::queue method for creating cookies that are automatically attached to the final response.", "backport": null} + {"message": "Added Cookie::queue method for creating cookies that are automatically attached to the final response.", "backport": null}, + {"message": "Allow environment to be checked via App::environment method.", "backport": null} ] }
true
Other
laravel
framework
4ee36a87e707056b38ade8e2f98b78041f1ee388.json
Use alternative mockery syntax to create partials As of padraic/mockery@deff698, if you use the [] partial syntax, mockery will call the mock target's constructor regardless of any args being specified.
tests/Database/DatabaseQueryBuilderTest.php
@@ -731,7 +731,7 @@ public function testDynamicWhere() { $method = 'whereFooBarAndBazOrQux'; $parameters = array('corge', 'waldo', 'fred'); - $builder = m::mock('Illuminate\Database\Query\Builder[where]'); + $builder = m::mock('Illuminate\Database\Query\Builder')->makePartial(); $builder->shouldReceive('where')->with('foo_bar', '=', $parameters[0], 'and')->once()->andReturn($builder); $builder->shouldReceive('where')->with('baz', '=', $parameters[1], 'and')->once()->andReturn($builder); @@ -745,7 +745,7 @@ public function testDynamicWhereIsNotGreedy() { $method = 'whereIosVersionAndAndroidVersionOrOrientation'; $parameters = array('6.1', '4.2', 'Vertical'); - $builder = m::mock('Illuminate\Database\Query\Builder[where]'); + $builder = m::mock('Illuminate\Database\Query\Builder')->makePartial(); $builder->shouldReceive('where')->with('ios_version', '=', '6.1', 'and')->once()->andReturn($builder); $builder->shouldReceive('where')->with('android_version', '=', '4.2', 'and')->once()->andReturn($builder);
true
Other
laravel
framework
4ee36a87e707056b38ade8e2f98b78041f1ee388.json
Use alternative mockery syntax to create partials As of padraic/mockery@deff698, if you use the [] partial syntax, mockery will call the mock target's constructor regardless of any args being specified.
tests/Foundation/ProviderRepositoryTest.php
@@ -15,7 +15,7 @@ public function testServicesAreRegisteredWhenManifestIsNotRecompiled() $repo = m::mock('Illuminate\Foundation\ProviderRepository[createProvider,loadManifest,shouldRecompile]', array(m::mock('Illuminate\Filesystem\Filesystem'), array(__DIR__))); $repo->shouldReceive('loadManifest')->once()->andReturn(array('eager' => array('foo'), 'deferred' => array('deferred'), 'providers' => array('providers'))); $repo->shouldReceive('shouldRecompile')->once()->andReturn(false); - $app = m::mock('Illuminate\Foundation\Application[register,setDeferredServices,runningInConsole]'); + $app = m::mock('Illuminate\Foundation\Application')->makePartial(); $provider = m::mock('Illuminate\Support\ServiceProvider'); $repo->shouldReceive('createProvider')->once()->with($app, 'foo')->andReturn($provider); $app->shouldReceive('register')->once()->with($provider); @@ -31,7 +31,7 @@ public function testServicesAreNeverLazyLoadedWhenRunningInConsole() $repo = m::mock('Illuminate\Foundation\ProviderRepository[createProvider,loadManifest,shouldRecompile]', array(m::mock('Illuminate\Filesystem\Filesystem'), array(__DIR__))); $repo->shouldReceive('loadManifest')->once()->andReturn(array('eager' => array('foo'), 'deferred' => array('deferred'), 'providers' => array('providers'))); $repo->shouldReceive('shouldRecompile')->once()->andReturn(false); - $app = m::mock('Illuminate\Foundation\Application[register,setDeferredServices,runningInConsole]'); + $app = m::mock('Illuminate\Foundation\Application')->makePartial(); $provider = m::mock('Illuminate\Support\ServiceProvider'); $repo->shouldReceive('createProvider')->once()->with($app, 'providers')->andReturn($provider); $app->shouldReceive('register')->once()->with($provider); @@ -104,4 +104,4 @@ public function testWriteManifestStoresToProperLocation() $this->assertEquals(array('foo'), $result); } -} \ No newline at end of file +}
true
Other
laravel
framework
4ee36a87e707056b38ade8e2f98b78041f1ee388.json
Use alternative mockery syntax to create partials As of padraic/mockery@deff698, if you use the [] partial syntax, mockery will call the mock target's constructor regardless of any args being specified.
tests/Queue/QueueListenerTest.php
@@ -12,9 +12,9 @@ public function tearDown() public function testRunProcessCallsProcess() { - $process = m::mock('Symfony\Component\Process\Process[run]'); + $process = m::mock('Symfony\Component\Process\Process')->makePartial(); $process->shouldReceive('run')->once(); - $listener = m::mock('Illuminate\Queue\Listener[memoryExceeded]'); + $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(false); $listener->runProcess($process, 1); @@ -23,9 +23,9 @@ public function testRunProcessCallsProcess() public function testListenerStopsWhenMemoryIsExceeded() { - $process = m::mock('Symfony\Component\Process\Process[run]'); + $process = m::mock('Symfony\Component\Process\Process')->makePartial(); $process->shouldReceive('run')->once(); - $listener = m::mock('Illuminate\Queue\Listener[memoryExceeded,stop]'); + $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(true); $listener->shouldReceive('stop')->once();
true
Other
laravel
framework
9b5dcf62cc8dd6021349d77d9c97e409cc3c8c00.json
Upgrade some dependencies.
composer.json
@@ -14,7 +14,7 @@ "classpreloader/classpreloader": "1.0.*", "doctrine/dbal": "2.4.*", "ircmaxell/password-compat": "1.0.*", - "filp/whoops": "1.0.7", + "filp/whoops": "1.0.8", "jeremeamia/superclosure": "1.0.*", "monolog/monolog": "1.6.*", "nesbot/carbon": "1.*", @@ -64,9 +64,9 @@ "illuminate/workbench": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "2.2.*", - "iron-io/iron_mq": "1.4.4", - "pda/pheanstalk": "2.0.*", + "aws/aws-sdk-php": "2.4.*", + "iron-io/iron_mq": "1.4.*", + "pda/pheanstalk": "2.1.*", "mockery/mockery": "0.8.0", "phpunit/phpunit": "3.7.*" },
true
Other
laravel
framework
9b5dcf62cc8dd6021349d77d9c97e409cc3c8c00.json
Upgrade some dependencies.
src/Illuminate/Queue/composer.json
@@ -16,7 +16,7 @@ "symfony/process": "2.3.*" }, "require-dev": { - "aws/aws-sdk-php": "2.1.*", + "aws/aws-sdk-php": "2.4.*", "mockery/mockery": "0.7.2", "phpunit/phpunit": "3.7.*" },
true
Other
laravel
framework
fa63cee024d188a5c193bddbeb8286752f0f5afc.json
Add a unique index to migration column
src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php
@@ -121,7 +121,7 @@ public function createRepository() // The migrations table is responsible for keeping track of which of the // migrations have actually run for the application. We'll create the // table to hold the migration file's path as well as the batch ID. - $table->string('migration'); + $table->string('migration')->unique(); $table->integer('batch'); });
false
Other
laravel
framework
8ce994be732fedafd9ae8619afb17c0bf6e8ef02.json
Remove change that is no longer applicable.
src/Illuminate/Foundation/changes.json
@@ -2,7 +2,6 @@ "4.1.x": [ {"message": "Added new SSH task runner tools.", "backport": null}, {"message": "Allow before and after validation rules to reference other fields.", "backport": null}, - {"message": "When access view data via __get, it is now returned by reference.", "backport": null}, {"message": "Added splice method to Collection class.", "backport": null}, {"message": "Added newest and oldest methods to query builder for timestamp short-hand queries.", "backport": null}, {"message": "Rebuild the routing layer for speed and efficiency.", "backport": null},
false
Other
laravel
framework
cb93bf3df8d25c04939462f81b75ddb9e4e6faa0.json
Allow escaping of Blade echos using @ sign.
src/Illuminate/View/Compilers/BladeCompiler.php
@@ -190,9 +190,14 @@ protected function compileEchos($value) */ protected function compileRegularEchos($value) { - $pattern = sprintf('/%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]); + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]); - return preg_replace($pattern, '<?php echo $1; ?>', $value); + $callback = function($matches) + { + return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$matches[2].'; ?>'; + }; + + return preg_replace_callback($pattern, $callback, $value); } /**
true
Other
laravel
framework
cb93bf3df8d25c04939462f81b75ddb9e4e6faa0.json
Allow escaping of Blade echos using @ sign.
tests/View/ViewBladeCompilerTest.php
@@ -74,6 +74,20 @@ public function testEchosAreCompiled() } + public function testEscapedWithAtEchosAreCompiled() + { + $compiler = new BladeCompiler($this->getFiles(), __DIR__); + $this->assertEquals('{{$name}}', $compiler->compileString('@{{$name}}')); + $this->assertEquals('{{ $name }}', $compiler->compileString('@{{ $name }}')); + $this->assertEquals('{{ + $name + }}', + $compiler->compileString('@{{ + $name + }}')); + } + + public function testReversedEchosAreCompiled() { $compiler = new BladeCompiler($this->getFiles(), __DIR__);
true
Other
laravel
framework
ee25cd0f7ec18be23e902531b984ef5278b4aff5.json
Fix casing issue on hasColumn.
src/Illuminate/Database/Schema/Builder.php
@@ -58,7 +58,9 @@ public function hasColumn($table, $column) { $schema = $this->connection->getDoctrineSchemaManager(); - return in_array($column, array_keys($schema->listTableColumns($table))); + $columns = array_keys(array_change_key_case($schema->listTableColumns($table))); + + return in_array(strtolower($column), $columns); } /**
false
Other
laravel
framework
c77a9fd08e8b0ad3368acc9a700d572c4dff251c.json
Add dropSoftDeletes method to migrations Signed-off-by: Daniel Bondergaard <danielboendergaard@gmail.com>
src/Illuminate/Database/Schema/Blueprint.php
@@ -269,6 +269,16 @@ public function dropTimestamps() $this->dropColumn('created_at', 'updated_at'); } + /** + * Indicate that the soft delete column should be dropped. + * + * @return void + */ + public function dropSoftDeletes() + { + $this->dropColumn('deleted_at'); + } + /** * Rename the table to a given name. *
false
Other
laravel
framework
ed84a35ee1d5256ed7ee9168d8748ad0792dadaf.json
Fix exception handling in Boris CLI
src/Illuminate/Foundation/Console/TinkerCommand.php
@@ -44,6 +44,15 @@ public function fire() */ protected function runBorisShell() { + // Disable the exception/error handlers so Boris can handle them + restore_error_handler(); + restore_exception_handler(); + $this->laravel->make('artisan')->setCatchExceptions(false); + + // Stop the shutdown handler outputting a JSON error object + $this->laravel->error(function() { return ''; }); + + // Run Boris with(new \Boris\Boris('> '))->start(); return; @@ -107,4 +116,4 @@ protected function supportsBoris() return (extension_loaded('readline') and extension_loaded('posix')); } -} \ No newline at end of file +}
false
Other
laravel
framework
dfaeb785e478981a49dd1a0e4c95faadbd69ba50.json
Fix unguarded bug.
src/Illuminate/Database/Eloquent/Model.php
@@ -322,7 +322,7 @@ public function fill(array $attributes) */ protected function fillableFromArray(array $attributes) { - if (count($this->fillable) > 0) + if (count($this->fillable) > 0 and ! static::$unguarded) { return array_intersect_key($attributes, array_flip($this->fillable)); }
false
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
composer.json
@@ -23,16 +23,16 @@ "predis/predis": "0.8.*", "react/socket": "0.3.*", "swiftmailer/swiftmailer": "5.0.*", - "symfony/browser-kit": "2.3.*", - "symfony/console": "2.3.*", - "symfony/css-selector": "2.3.*", - "symfony/debug": "2.3.*", - "symfony/dom-crawler": "2.3.*", - "symfony/finder": "2.3.*", - "symfony/http-foundation": "2.3.*", - "symfony/http-kernel": "2.3.*", - "symfony/process": "2.3.*", - "symfony/translation": "2.3.*" + "symfony/browser-kit": "2.4.*", + "symfony/console": "2.4.*", + "symfony/css-selector": "2.4.*", + "symfony/debug": "2.4.*", + "symfony/dom-crawler": "2.4.*", + "symfony/finder": "2.4.*", + "symfony/http-foundation": "2.4.*", + "symfony/http-kernel": "2.4.*", + "symfony/process": "2.4.*", + "symfony/translation": "2.4.*" }, "replace": { "illuminate/auth": "self.version",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Console/composer.json
@@ -8,7 +8,7 @@ } ], "require": { - "symfony/console": "2.3.*" + "symfony/console": "2.4.*" }, "require-dev": { "phpunit/phpunit": "3.7.*"
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Cookie/composer.json
@@ -11,7 +11,7 @@ "php": ">=5.3.0", "illuminate/encryption": "4.1.x", "illuminate/support": "4.1.x", - "symfony/http-foundation": "2.3.*" + "symfony/http-foundation": "2.4.*" }, "require-dev": { "mockery/mockery": "0.7.2",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Exception/composer.json
@@ -11,8 +11,8 @@ "php": ">=5.3.0", "filp/whoops": "1.0.7", "illuminate/support": "4.1.x", - "symfony/http-foundation": "2.3.x", - "symfony/http-kernel": "2.3.*" + "symfony/http-foundation": "2.4.x", + "symfony/http-kernel": "2.4.*" }, "require-dev": { "monolog/monolog": "1.6.x",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Filesystem/composer.json
@@ -9,8 +9,8 @@ ], "require": { "php": ">=5.3.0", - "illuminate/support": "4.1.x", - "symfony/finder": "2.3.x" + "illuminate/support": "4.1.*", + "symfony/finder": "2.4.*" }, "require-dev": { "phpunit/phpunit": "3.7.*"
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Http/composer.json
@@ -10,7 +10,7 @@ "require": { "illuminate/session": "4.1.x", "illuminate/support": "4.1.x", - "symfony/http-foundation": "2.3.*" + "symfony/http-foundation": "2.4.*" }, "require-dev": { "mockery/mockery": "0.7.2",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Pagination/composer.json
@@ -12,8 +12,8 @@ "illuminate/http": "4.1.x", "illuminate/support": "4.1.x", "illuminate/view": "4.1.x", - "symfony/http-foundation": "2.3.*", - "symfony/translation": "2.3.*" + "symfony/http-foundation": "2.4.*", + "symfony/translation": "2.4.*" }, "require-dev": { "mockery/mockery": "0.7.2",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Queue/composer.json
@@ -13,7 +13,7 @@ "illuminate/container": "4.1.x", "illuminate/http": "4.1.x", "illuminate/support": "4.1.x", - "symfony/process": "2.3.*" + "symfony/process": "2.4.*" }, "require-dev": { "aws/aws-sdk-php": "2.1.*",
true
Other
laravel
framework
8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json
Update Symfony dependencies to 2.4.*
src/Illuminate/Routing/composer.json
@@ -12,9 +12,8 @@ "illuminate/http": "4.1.x", "illuminate/session": "4.1.x", "illuminate/support": "4.1.x", - "symfony/http-foundation": "2.3.*", - "symfony/http-kernel": "2.3.*", - "symfony/routing": "2.3.*" + "symfony/http-foundation": "2.4.*", + "symfony/http-kernel": "2.4.*" }, "require-dev": { "illuminate/console": "4.1.x",
true