Skip to content

Commit

Permalink
Merge branch 'clarify-mass-assignment-exception-wording' of https://g…
Browse files Browse the repository at this point in the history
…ithub.com/ok200paul/framework into ok200paul-clarify-mass-assignment-exception-wording
  • Loading branch information
taylorotwell committed Dec 29, 2017
2 parents ee0a5ff + c7f14fb commit fd99eba
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
Thumbs.db
/phpunit.xml
/.idea
/.vscode
20 changes: 20 additions & 0 deletions CHANGELOG-5.5.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Release Notes for 5.5.x

## [Unreleased]

### Changed
- Use `Arr::get()` in `Collection::get()` ([#22554](https://github.com/laravel/framework/pull/22554))
- Pass entire config to `FtpAdapter` ([#22539](https://github.com/laravel/framework/pull/22539))


## v5.5.28 (2017-12-26)

### Added
- Added `AnonymousNotifiable::notifyNow()` method ([#22530](https://github.com/laravel/framework/pull/22530))
- Added `EventFake::assertDispatchedTimes()` method ([#22528](https://github.com/laravel/framework/pull/22528))

### Changed
- Check for `--no-interaction` flag on command calls ([#22515](https://github.com/laravel/framework/pull/22515), [ba5e31d](https://github.com/laravel/framework/commit/ba5e31dde341884b3bf03178d1a529abd55e7886))

### Fixed
- Fix Validator not handling properly inline messages for `size` rules ([#22518](https://github.com/laravel/framework/pull/22518), [690d9fc](https://github.com/laravel/framework/commit/690d9fcc380252806cd19c164af843ccb3e801d9))


## v5.5.27 (2017-12-20)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Faker\Generator as Faker;

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(DummyModel::class, function (Faker $faker) {
return [
//
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function fill(array $attributes)
if ($this->isFillable($key)) {
$this->setAttribute($key, $value);
} elseif ($totallyGuarded) {
throw new MassAssignmentException($key);
throw new MassAssignmentException('Model is guarded. Add key ['.$key.'] to $fillable to allow mass assignment.');
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,8 @@ public function createLocalDriver(array $config)
*/
public function createFtpDriver(array $config)
{
$ftpConfig = Arr::only($config, [
'host', 'username', 'password', 'port', 'root', 'passive', 'ssl', 'timeout',
]);

return $this->adapt($this->createFlysystem(
new FtpAdapter($ftpConfig), $config
new FtpAdapter($config), $config
));
}

Expand Down
6 changes: 1 addition & 5 deletions src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,7 @@ public function forget($keys)
*/
public function get($key, $default = null)
{
if ($this->offsetExists($key)) {
return $this->items[$key];
}

return value($default);
return Arr::get($this->items, $key, $default);
}

/**
Expand Down
21 changes: 21 additions & 0 deletions tests/Filesystem/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace Illuminate\Tests\Filesystem;

use PHPUnit\Framework\TestCase;
use League\Flysystem\Adapter\Ftp;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\Application;
use Illuminate\Filesystem\FilesystemManager;

class FilesystemTest extends TestCase
{
Expand Down Expand Up @@ -441,4 +444,22 @@ public function testAllFilesReturnsFileInfoObjects()
$this->assertInstanceOf(\SplFileInfo::class, $file);
}
}

public function testCreateFtpDriver()
{
$filesystem = new FilesystemManager(new Application());

$driver = $filesystem->createFtpDriver([
'host' => 'ftp.example.com',
'username' => 'admin',
'permPublic' => 0700,
'unsopertedParam' => true,
]);

/** @var Ftp $adapter */
$adapter = $driver->getAdapter();
$this->assertEquals(0700, $adapter->getPermPublic());
$this->assertEquals('ftp.example.com', $adapter->getHost());
$this->assertEquals('admin', $adapter->getUsername());
}
}
21 changes: 21 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,27 @@ public function testUnlessDefault()

$this->assertSame(['michael', 'tom', 'taylor'], $collection->toArray());
}

public function testGetNestedValue()
{
$collection = new Collection([
'foo' => [
'bar' => 'baz',
'books' => [
'Book 1',
'Book 2',
],
'todos' => [
'first' => 'Todo 1',
'second' => 'Todo 2',
],
],
]);

$this->assertEquals('baz', $collection->get('foo.bar'));
$this->assertEquals('Book 1', $collection->get('foo.books.0'));
$this->assertEquals('Todo 2', $collection->get('foo.todos.second'));
}
}

class TestSupportCollectionHigherOrderItem
Expand Down

0 comments on commit fd99eba

Please sign in to comment.