| @@ 71-90 (lines=20) @@ | ||
| 68 | $this->assertContains('not allowed to upload a file with extension', $this->client->getResponse()->getContent()); |
|
| 69 | } |
|
| 70 | ||
| 71 | public function testEmptyFileUpload() |
|
| 72 | { |
|
| 73 | $provider = 'file'; |
|
| 74 | ||
| 75 | $crawler = $this->client->request('GET', self::BASE_PATH.'create?provider='.$provider); |
|
| 76 | ||
| 77 | $form = $crawler->selectButton('Create')->form(); |
|
| 78 | ||
| 79 | $this->assertSonataFormValues( |
|
| 80 | $form, |
|
| 81 | [ |
|
| 82 | 'provider' => $provider, |
|
| 83 | ] |
|
| 84 | ); |
|
| 85 | ||
| 86 | $this->client->submit($form); |
|
| 87 | ||
| 88 | $this->assertContains('This value should not be blank', $this->client->getResponse()->getContent()); |
|
| 89 | $this->assertContains('This value should not be blank', $this->client->getResponse()->getContent()); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @param string $fileName |
|
| @@ 59-78 (lines=20) @@ | ||
| 56 | $this->assertArrayHasKey('url', $data); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function testEmptyFileUpload() |
|
| 60 | { |
|
| 61 | $provider = 'image'; |
|
| 62 | ||
| 63 | $crawler = $this->client->request('GET', self::BASE_PATH.'create?provider='.$provider); |
|
| 64 | ||
| 65 | $form = $crawler->selectButton('Create')->form(); |
|
| 66 | ||
| 67 | $this->assertSonataFormValues( |
|
| 68 | $form, |
|
| 69 | [ |
|
| 70 | 'provider' => $provider, |
|
| 71 | ] |
|
| 72 | ); |
|
| 73 | ||
| 74 | $this->client->submit($form); |
|
| 75 | ||
| 76 | $this->assertContains('This value should not be blank', $this->client->getResponse()->getContent()); |
|
| 77 | $this->assertContains('This value should not be blank', $this->client->getResponse()->getContent()); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||