Skip to content

Commit 7c4e7ee

Browse files
author
Elliot Levin
committed
Add travis config
1 parent cbbe26c commit 7c4e7ee

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
dist: trusty
2+
language: php
3+
4+
php:
5+
- 7.0
6+
- 7.1
7+
- nightly
8+
9+
before_script:
10+
- composer self-update
11+
- composer install --no-interaction
12+
13+
script:
14+
- ./vendor/bin/phpunit -c tests/phpunit.xml
15+
16+
matrix:
17+
allow_failures:
18+
- php: nightly
19+
20+
cache:
21+
directories:
22+
- $HOME/.composer/cache

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"autoload-dev": {
2323
"psr-4": {
2424
"Dms\\Common\\Structure\\Tests\\": "./tests/Tests",
25-
"Dms\\Core\\Tests\\": "./vendor/dms/core/tests/Tests"
25+
"Dms\\Core\\Tests\\": "./vendor/dms-org/core/tests/Tests"
2626
}
2727
},
2828
"require-dev": {

tests/Tests/FileSystem/Form/ImageUploadTypeTest.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ protected function uploadClass()
4545

4646
protected function mockUploadedFile($name, $fileSize = 10, $isValidImage = true, $height = 10, $width = 10)
4747
{
48-
$mock = $this->getMock(
49-
UploadedImage::class,
50-
['getSize', 'isValidImage', 'getHeight', 'getWidth'],
51-
['somepath/' . $name, UPLOAD_ERR_OK]
52-
);
48+
$mock = $this->getMockBuilder(UploadedImage::class)
49+
->setMethods(['getSize', 'isValidImage', 'getHeight', 'getWidth'])
50+
->setConstructorArgs(['somepath/' . $name, UPLOAD_ERR_OK])
51+
->getMock();
5352

5453
$mock->method('getSize')->willReturn($fileSize);
5554
$mock->method('getHeight')->willReturn($height);
@@ -62,13 +61,13 @@ protected function mockUploadedFile($name, $fileSize = 10, $isValidImage = true,
6261
public function testInvalidImage()
6362
{
6463
$this->testValidation(
65-
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, false)],
66-
[new Message(UploadedImageValidator::MESSAGE, ['field' => 'File', 'input' => $file])]
64+
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, false)],
65+
[new Message(UploadedImageValidator::MESSAGE, ['field' => 'File', 'input' => $file])]
6766
);
6867

6968
$this->testValidation(
70-
['action' => UploadAction::STORE_NEW, 'file' => $file = parent::mockUploadedFile('new', 1024)],
71-
[new Message(TypeValidator::MESSAGE, ['field' => 'File', 'input' => $file, 'type' => IUploadedImage::class . '|null'])]
69+
['action' => UploadAction::STORE_NEW, 'file' => $file = parent::mockUploadedFile('new', 1024)],
70+
[new Message(TypeValidator::MESSAGE, ['field' => 'File', 'input' => $file, 'type' => IUploadedImage::class . '|null'])]
7271
);
7372
}
7473

@@ -77,13 +76,13 @@ public function testMaxHeight()
7776
$this->loadFieldType((new ImageUploadType())->with(ImageUploadType::ATTR_MAX_HEIGHT, 100));
7877

7978
$this->testProcess(
80-
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, true, 100)],
81-
$file
79+
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, true, 100)],
80+
$file
8281
);
8382

8483
$this->testValidation(
85-
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, true, 101)],
86-
[new Message(ImageDimensionsValidator::MESSAGE_MAX_HEIGHT, ['field' => 'File', 'input' => $file, 'max_height' => 100])]
84+
['action' => UploadAction::STORE_NEW, 'file' => $file = $this->mockUploadedFile('new', 1024, true, 101)],
85+
[new Message(ImageDimensionsValidator::MESSAGE_MAX_HEIGHT, ['field' => 'File', 'input' => $file, 'max_height' => 100])]
8786
);
8887
}
8988
}

0 commit comments

Comments
 (0)