|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Created by PhpStorm. |
| 4 | + * User: alex |
| 5 | + * Date: 18/03/19 |
| 6 | + * Time: 5:31 AM |
| 7 | + */ |
| 8 | + |
| 9 | +namespace CrestApps\CodeGenerator\Tests; |
| 10 | + |
| 11 | +use Illuminate\Support\Facades\Artisan; |
| 12 | +use Illuminate\Support\Facades\File; |
| 13 | + |
| 14 | +class ResourceFileCreateCommandTest extends TestCase |
| 15 | +{ |
| 16 | + public function testCreateResourceFileWithBigIntField() |
| 17 | + { |
| 18 | + //first, mock out the file system so we don't accidentally scribble on something |
| 19 | + File::shouldReceive('exists')->andReturnNull(); |
| 20 | + File::shouldReceive('put')->andReturnNull(); |
| 21 | + File::shouldReceive('isDirectory')->andReturn(false); |
| 22 | + File::shouldReceive('makeDirectory')->andReturnNull(); |
| 23 | + |
| 24 | + // arguments we're passing in |
| 25 | + $fieldString = 'name:foo_count;data-type:bigint'; |
| 26 | + |
| 27 | + // now call Artisan |
| 28 | + Artisan::call('resource-file:create', ['model-name' => 'TestModel', '--fields' => $fieldString]); |
| 29 | + // Vacuous assertion to give PHPUnit something to do instead of complaining about a risky test |
| 30 | + $this->assertTrue(true); |
| 31 | + } |
| 32 | + |
| 33 | + public function testCreateResourceFileWithBigIntegerField() |
| 34 | + { |
| 35 | + //first, mock out the file system so we don't accidentally scribble on something |
| 36 | + File::shouldReceive('exists')->andReturnNull(); |
| 37 | + File::shouldReceive('put')->andReturnNull(); |
| 38 | + File::shouldReceive('isDirectory')->andReturn(false); |
| 39 | + File::shouldReceive('makeDirectory')->andReturnNull(); |
| 40 | + |
| 41 | + // arguments we're passing in |
| 42 | + $fieldString = 'name:foo_count;data-type:biginteger'; |
| 43 | + |
| 44 | + // now call Artisan |
| 45 | + Artisan::call('resource-file:create', ['model-name' => 'TestModel', '--fields' => $fieldString]); |
| 46 | + // Vacuous assertion to give PHPUnit something to do instead of complaining about a risky test |
| 47 | + $this->assertTrue(true); |
| 48 | + } |
| 49 | +} |
0 commit comments