Skip to content

Commit

Permalink
Merge branch 'master' into 9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ivanov committed Aug 21, 2022
2 parents 1221ca2 + a6c6b30 commit 0990aaa
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 195 deletions.
57 changes: 0 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ Laravel-specific Testing Helpers and Assertions.
- [dontSeeLogFile](#dontseelogfile)
- [seeInLogFile](#seeinlogfile)
- [dontSeeInLogFile](#dontseeinlogfile)
- [ReflectionAsserts](#reflectionasserts)
- [assertSubclassOf](#assertsubclassof)
- [assertNotSubclassOf](#assertnotsubclassof)
- [assertTraitUsed](#asserttraitused)
- [assertTraitNotUsed](#asserttraitnotused)
- [assertMethodExists](#assertmethodexists)
- [assertMethodNotExists](#assertmethodnotexists)
- [ScheduleAsserts](#scheduleasserts)
- [seeScheduleCount](#seeschedulecount)
- [dontSeeScheduleCount](#dontseeschedulecount)
Expand Down Expand Up @@ -307,56 +300,6 @@ $this->dontSeeInLogFile('example.log', [
]);
```
### ReflectionAsserts
#### `assertSubclassOf()`
Assert that class is a subclass of the given parent:
```php
$this->assertSubclassOf(Post::class, Model::class);
```
#### `assertNotSubclassOf()`
Assert that class is not a subclass of the given parent:
```php
$this->assertNotSubclassOf(Post::class, Command::class);
```
#### `assertTraitUsed()`
Assert that class uses the given trait:
```php
$this->assertTraitUsed(User::class, Notifiable::class);
```
#### `assertTraitNotUsed()`
Assert that class doesn't use the given trait:

```php
$this->assertTraitNotUsed(Post::class, Notifiable::class);
```

#### `assertMethodExists()`

Assert that object has the given method:

```php
$this->assertMethodExists(Post::class, 'save');
```

#### `assertMethodNotExists()`

Assert that object doesn't have the given method:
```php
$this->assertMethodNotExists(Post::class, 'fly');
```
### ScheduleAsserts
#### `seeScheduleCount()`
Expand Down
60 changes: 0 additions & 60 deletions src/Asserts/ReflectionAsserts.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/TestingTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminated\Testing\Asserts\DatabaseAsserts;
use Illuminated\Testing\Asserts\FilesystemAsserts;
use Illuminated\Testing\Asserts\LogFileAsserts;
use Illuminated\Testing\Asserts\ReflectionAsserts;
use Illuminated\Testing\Asserts\ScheduleAsserts;
use Illuminated\Testing\Asserts\ServiceProviderAsserts;
use Illuminated\Testing\Helpers\ApplicationHelpers;
Expand All @@ -21,7 +20,6 @@ trait TestingTools
use DatabaseAsserts;
use FilesystemAsserts;
use LogFileAsserts;
use ReflectionAsserts;
use ScheduleAsserts;
use ServiceProviderAsserts;
}
48 changes: 0 additions & 48 deletions tests/Asserts/ReflectionAssertsTest.php

This file was deleted.

9 changes: 9 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ protected function resolveApplicationConsoleKernel($app)

app(KernelContract::class);
}

/**
* Assert that class uses the given trait.
*/
protected function assertTraitUsed(string $class, string $trait): void
{
$message = "Failed asserting that class `{$class}` is using trait `{$trait}`.";
$this->assertContains($trait, class_uses($class), $message);
}
}
2 changes: 0 additions & 2 deletions tests/TestingToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminated\Testing\Asserts\DatabaseAsserts;
use Illuminated\Testing\Asserts\FilesystemAsserts;
use Illuminated\Testing\Asserts\LogFileAsserts;
use Illuminated\Testing\Asserts\ReflectionAsserts;
use Illuminated\Testing\Asserts\ScheduleAsserts;
use Illuminated\Testing\Asserts\ServiceProviderAsserts;
use Illuminated\Testing\Helpers\ApplicationHelpers;
Expand All @@ -27,7 +26,6 @@ public function it_is_using_all_testing_tools_asserts()
$this->assertTraitUsed(TestingTools::class, DatabaseAsserts::class);
$this->assertTraitUsed(TestingTools::class, FilesystemAsserts::class);
$this->assertTraitUsed(TestingTools::class, LogFileAsserts::class);
$this->assertTraitUsed(TestingTools::class, ReflectionAsserts::class);
$this->assertTraitUsed(TestingTools::class, ScheduleAsserts::class);
$this->assertTraitUsed(TestingTools::class, ServiceProviderAsserts::class);
}
Expand Down
11 changes: 0 additions & 11 deletions tests/fixture/app/Commentable.php

This file was deleted.

3 changes: 0 additions & 3 deletions tests/fixture/app/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@

class Post extends Model
{
use Commentable;
use HasFactory;

/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'posts';
}
3 changes: 0 additions & 3 deletions tests/fixture/database/factories/PostFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class PostFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Post::class;

Expand All @@ -21,7 +19,6 @@ public function definition(): array
{
return [
'title' => $this->faker->sentence,
'publish_at' => $this->faker->dateTimeThisYear,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@ public function up(): void
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->dateTime('publish_at');
$table->timestamps();
});
}

/**
* Rollback the migration.
*/
public function down(): void
{
Schema::drop('posts');
}
};

0 comments on commit 0990aaa

Please sign in to comment.