-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathCustomTaxonomyServiceProviderTest.php
More file actions
76 lines (62 loc) · 1.59 KB
/
CustomTaxonomyServiceProviderTest.php
File metadata and controls
76 lines (62 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Rareloop\Lumberjack\Test;
use Brain\Monkey\Functions;
use Mockery;
use PHPUnit\Framework\TestCase;
use Rareloop\Lumberjack\Application;
use Rareloop\Lumberjack\Config;
use Rareloop\Lumberjack\Term;
use Rareloop\Lumberjack\Providers\CustomTaxonomyServiceProvider;
use Rareloop\Lumberjack\Test\Unit\BrainMonkeyPHPUnitIntegration;
class CustomTaxonomyServiceProviderTest extends TestCase
{
use BrainMonkeyPHPUnitIntegration;
/** @test */
public function should_call_register_taxonomy_for_each_configured_taxonomy()
{
$app = new Application(__DIR__ . '/..');
$config = new Config;
$config->set('taxonomies.register', [
CustomTaxonomy1::class,
CustomTaxonomy2::class,
]);
Functions\expect('register_taxonomy')
->times(2);
$provider = new CustomTaxonomyServiceProvider($app);
$provider->boot($config);
}
}
class CustomTaxonomy1 extends Term
{
public static function getTaxonomyType()
{
return 'custom_taxonomy_1';
}
public static function getTaxonomyObjectTypes()
{
return ['post'];
}
protected static function getTaxonomyConfig()
{
return [
'not' => 'empty',
];
}
}
class CustomTaxonomy2 extends Term
{
public static function getTaxonomyType()
{
return 'custom_taxonomy_1';
}
public static function getTaxonomyObjectTypes()
{
return ['post'];
}
protected static function getTaxonomyConfig()
{
return [
'not' => 'empty',
];
}
}