Skip to content

Commit

Permalink
add default value for alt
Browse files Browse the repository at this point in the history
  • Loading branch information
frasmage committed Mar 31, 2024
1 parent 1751150 commit 661abc2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automated-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run phpunit
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml --verbose
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
env:
S3_KEY: ${{ secrets.S3_KEY }}
S3_SECRET: ${{ secrets.S3_SECRET }}
Expand Down
2 changes: 1 addition & 1 deletion migrations/2024_03_30_000000_add_alt_to_media.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function up()
Schema::table(
'media',
function (Blueprint $table) {
$table->text('alt');
$table->text('alt')->default('');
}
);
}
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuites>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests/Integration/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="true"/>
</php>
<source>
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</source>
</coverage>
</phpunit>
27 changes: 0 additions & 27 deletions phpunit.xml.bak

This file was deleted.

1 change: 0 additions & 1 deletion src/MediaUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Filesystem\FilesystemManager;
use League\Flysystem\UnableToRetrieveMetadata;
use Mimey\MimeTypes;
use Plank\Mediable\Exceptions\MediaUpload\ConfigurationException;
use Plank\Mediable\Exceptions\MediaUpload\FileExistsException;
use Plank\Mediable\Exceptions\MediaUpload\FileNotFoundException;
Expand Down
1 change: 1 addition & 0 deletions tests/Factories/ModelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'mime_type' => $faker->randomElement($types[$type]['mime_types']),
'aggregate_type' => $type,
'size' => $faker->randomNumber(),
'alt' => $faker->sentence,
];
});

Expand Down
14 changes: 14 additions & 0 deletions tests/Integration/MediaUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,20 @@ function (Media $model) {
);
}

public function test_it_applies_alt()
{
$this->useDatabase();
$this->useFilesystem('tmp');

$media = Facade::fromSource(TestCase::sampleFilePath())
->toDestination('tmp', 'foo')
->useFilename('bar')
->withAltAttribute('This is an alt text')
->upload();

$this->assertEquals('This is an alt text', $media->alt);
}

protected function getUploader(): MediaUploader
{
return app('mediable.uploader');
Expand Down

0 comments on commit 661abc2

Please sign in to comment.