1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

Laravel components v8 (#2576)

- update actions ci
- include json for 4 spaces tab
- provide output int for process code exit
- adhere to parent type hint of builder
- mailer instance now needs a name, multiple can be instantiated
- getOriginal now uses mutators in the model
- Temporarily loosen MailableInterface requirements. This avoids an immediate BC break for classes in extensions that implement this interface.
- Temporarily provide (and autoload) old symfony translator interface
- make queue exception handler compatible with the contract of L8
- Update phpunit schema for newer version
- Update phpunit assert calls for newer version
This commit is contained in:
Daniël Klabbers
2021-03-05 15:43:35 +01:00
committed by GitHub
parent e24d223ec0
commit 242593daf6
39 changed files with 214 additions and 174 deletions

View File

@@ -45,7 +45,7 @@ class WithApiKeyTest extends TestCase
$this->request('GET', '/api')
);
$data = json_decode($response->getBody(), true);
$data = json_decode($response->getBody()->getContents(), true);
$this->assertFalse($data['data']['attributes']['canViewUserList']);
}
@@ -59,7 +59,7 @@ class WithApiKeyTest extends TestCase
->withAddedHeader('Authorization', 'Token mastertoken; userId=1')
);
$data = json_decode($response->getBody(), true);
$data = json_decode($response->getBody()->getContents(), true);
$this->assertTrue($data['data']['attributes']['canViewUserList']);
$this->assertArrayHasKey('adminUrl', $data['data']['attributes']);
@@ -78,7 +78,7 @@ class WithApiKeyTest extends TestCase
->withAddedHeader('Authorization', 'Token personaltoken; userId=1')
);
$data = json_decode($response->getBody(), true);
$data = json_decode($response->getBody()->getContents(), true);
$this->assertTrue($data['data']['attributes']['canViewUserList']);
$this->assertArrayNotHasKey('adminUrl', $data['data']['attributes']);
@@ -97,7 +97,7 @@ class WithApiKeyTest extends TestCase
->withAddedHeader('Authorization', 'Token personaltoken')
);
$data = json_decode($response->getBody(), true);
$data = json_decode($response->getBody()->getContents(), true);
$this->assertTrue($data['data']['attributes']['canViewUserList']);
$this->assertArrayNotHasKey('adminUrl', $data['data']['attributes']);

View File

@@ -86,7 +86,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -105,7 +105,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -124,7 +124,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -143,7 +143,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -162,7 +162,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -181,7 +181,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -200,7 +200,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['4'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['4'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -219,7 +219,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -241,7 +241,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -263,7 +263,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -282,7 +282,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -301,7 +301,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -320,7 +320,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -339,7 +339,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -358,7 +358,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -377,7 +377,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['1'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -396,7 +396,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['4'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['4'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -415,7 +415,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2', '3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2', '3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -437,7 +437,7 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], Arr::pluck($data, 'id'), 'IDs do not match');
}
/**
@@ -459,6 +459,6 @@ class ListTest extends TestCase
$data = json_decode($response->getBody()->getContents(), true)['data'];
// Order-independent comparison
$this->assertEquals(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match', 0.0, 10, true);
$this->assertEqualsCanonicalizing(['1', '2'], Arr::pluck($data, 'id'), 'IDs do not match');
}
}

View File

@@ -75,7 +75,7 @@ class ListTest extends TestCase
}, $data['data']);
// Order-independent comparison
$this->assertEquals(['3'], $ids, 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], $ids, 'IDs do not match');
}
/**
@@ -97,7 +97,7 @@ class ListTest extends TestCase
}, $data['data']);
// Order-independent comparison
$this->assertEquals(['3'], $ids, 'IDs do not match', 0.0, 10, true);
$this->assertEquals(['3'], $ids, 'IDs do not match');
}
/**

View File

@@ -68,7 +68,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals('dataSerializationPrepCustomTitle', $payload['data']['attributes']['title']);
}
@@ -89,7 +89,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals(CustomPrepareDataSerializationInvokableClass::class, $payload['data']['attributes']['title']);
}
@@ -115,7 +115,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('referenceTest', $payload['data']['relationships']);
}
@@ -139,7 +139,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('referenceTest2', $payload['data']['relationships']);
}
@@ -164,7 +164,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals('dataSerializationPrepCustomTitle2', $payload['data']['attributes']['title']);
}
@@ -193,7 +193,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals('dataSerializationPrepCustomTitle4', $payload['data']['attributes']['title']);
}
@@ -218,7 +218,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSerializer2', $payload['data']['attributes']);
}
@@ -247,7 +247,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSerializer', $payload['data']['attributes']);
}
@@ -263,7 +263,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('customSerializer', $payload['data']['attributes']);
}
@@ -284,7 +284,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSerializer', $payload['data']['attributes']);
}
@@ -310,7 +310,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSerializer', $payload['data']['attributes']);
}
@@ -333,7 +333,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('customSerializer', $payload['data']['attributes']);
}
@@ -349,7 +349,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('customApiControllerRelation', $payload['data']['relationships']);
$this->assertArrayNotHasKey('customApiControllerRelation2', $payload['data']['relationships']);
@@ -375,7 +375,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customApiControllerRelation', $payload['data']['relationships']);
}
@@ -402,7 +402,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customApiControllerRelation2', $payload['data']['relationships']);
}
@@ -418,7 +418,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('groups', $payload['data']['relationships']);
}
@@ -439,7 +439,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('groups', Arr::get($payload, 'data.relationships', []));
}
@@ -481,7 +481,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertCount(3, $payload['data']);
}
@@ -502,7 +502,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertCount(1, $payload['data']);
}
@@ -525,7 +525,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertCount(1, $payload['data']);
}
@@ -587,7 +587,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals([3, 1, 2], Arr::pluck($payload['data'], 'id'));
@@ -647,7 +647,7 @@ class ApiControllerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals([2, 1, 3], Arr::pluck($payload['data'], 'id'));

View File

@@ -62,7 +62,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('customAttribute', $payload['data']['attributes']);
}
@@ -89,7 +89,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customAttribute', $payload['data']['attributes']);
}
@@ -112,7 +112,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customAttributeFromInvokable', $payload['data']['attributes']);
}
@@ -139,7 +139,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customAttribute', $payload['data']['attributes']);
}
@@ -172,7 +172,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customAttribute', $payload['data']['attributes']);
$this->assertEquals('newValue', $payload['data']['attributes']['customAttribute']);
@@ -200,7 +200,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSingleAttribute', $payload['data']['attributes']);
$this->assertArrayHasKey('customSingleAttribute_0', $payload['data']['attributes']);
@@ -225,7 +225,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSingleAttribute_1', $payload['data']['attributes']);
}
@@ -250,7 +250,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSingleAttribute_2', $payload['data']['attributes']);
}
@@ -279,7 +279,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customSingleAttribute_3', $payload['data']['attributes']);
$this->assertEquals('newValue', $payload['data']['attributes']['customSingleAttribute_3']);
@@ -312,7 +312,7 @@ class ApiSerializerTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('someCustomAttribute', $payload['data']['attributes']);
$this->assertEquals('newValue', $payload['data']['attributes']['someCustomAttribute']);

View File

@@ -18,7 +18,7 @@ use Flarum\Tests\integration\TestCase;
use Flarum\User\User;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class EventTest extends TestCase
{

View File

@@ -60,8 +60,8 @@ class FilterTest extends TestCase
$this->prepDb();
$searchForAll = json_encode($this->filterDiscussions([], 5));
$this->assertContains('DISCUSSION 1', $searchForAll);
$this->assertContains('DISCUSSION 2', $searchForAll);
$this->assertStringContainsString('DISCUSSION 1', $searchForAll);
$this->assertStringContainsString('DISCUSSION 2', $searchForAll);
}
/**
@@ -74,8 +74,8 @@ class FilterTest extends TestCase
$this->prepDb();
$withResultSearch = json_encode($this->filterDiscussions(['noResult' => 0], 5));
$this->assertContains('DISCUSSION 1', $withResultSearch);
$this->assertContains('DISCUSSION 2', $withResultSearch);
$this->assertStringContainsString('DISCUSSION 1', $withResultSearch);
$this->assertStringContainsString('DISCUSSION 2', $withResultSearch);
$this->assertEquals([], $this->filterDiscussions(['noResult' => 1], 5));
}

View File

@@ -34,7 +34,7 @@ class MailTest extends TestCase
])
);
$fields = json_decode($response->getBody(), true)['data']['attributes']['fields'];
$fields = json_decode($response->getBody()->getContents(), true)['data']['attributes']['fields'];
// The custom driver does not exist
$this->assertArrayNotHasKey('custom', $fields);
@@ -65,7 +65,7 @@ class MailTest extends TestCase
])
);
$fields = json_decode($response->getBody(), true)['data']['attributes']['fields'];
$fields = json_decode($response->getBody()->getContents(), true)['data']['attributes']['fields'];
$this->assertArrayHasKey('custom', $fields);
$this->assertEquals(['customSetting1' => ''], $fields['custom']);
@@ -87,7 +87,7 @@ class MailTest extends TestCase
])
);
$requiredFields = json_decode($response->getBody(), true)['data']['attributes']['fields']['smtp'];
$requiredFields = json_decode($response->getBody()->getContents(), true)['data']['attributes']['fields']['smtp'];
$this->assertEquals(['customSetting1' => ''], $requiredFields);
}

View File

@@ -50,7 +50,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayNotHasKey('customPrefix.customSetting', $payload['data']['attributes']);
}
@@ -73,7 +73,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customPrefix.customSetting', $payload['data']['attributes']);
$this->assertEquals('customValue', $payload['data']['attributes']['customPrefix.customSetting']);
@@ -99,7 +99,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customPrefix.customSetting', $payload['data']['attributes']);
$this->assertEquals('customValueModified', $payload['data']['attributes']['customPrefix.customSetting']);
@@ -123,7 +123,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customPrefix.customSetting2', $payload['data']['attributes']);
$this->assertEquals('customValueModifiedByInvokable', $payload['data']['attributes']['customPrefix.customSetting2']);
@@ -147,7 +147,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customPrefix.noCustomSetting', $payload['data']['attributes']);
$this->assertEquals('customDefault', $payload['data']['attributes']['customPrefix.noCustomSetting']);
@@ -173,7 +173,7 @@ class SettingsTest extends TestCase
])
);
$payload = json_decode($response->getBody(), true);
$payload = json_decode($response->getBody()->getContents(), true);
$this->assertArrayHasKey('customPrefix.noCustomSetting', $payload['data']['attributes']);
$this->assertEquals('customDefaultModified2', $payload['data']['attributes']['customPrefix.noCustomSetting']);

View File

@@ -77,12 +77,12 @@ class SimpleFlarumSearchTest extends TestCase
$this->prepDb();
$searchForAll = json_encode($this->searchDiscussions('in text', 5));
$this->assertContains('DISCUSSION 1', $searchForAll);
$this->assertContains('DISCUSSION 2', $searchForAll);
$this->assertStringContainsString('DISCUSSION 1', $searchForAll);
$this->assertStringContainsString('DISCUSSION 2', $searchForAll);
$searchForSecond = json_encode($this->searchDiscussions('lightsail', 5));
$this->assertNotContains('DISCUSSION 1', $searchForSecond);
$this->assertContains('DISCUSSION 2', $searchForSecond);
$this->assertStringNotContainsString('DISCUSSION 1', $searchForSecond);
$this->assertStringContainsString('DISCUSSION 2', $searchForSecond);
}
/**
@@ -105,8 +105,8 @@ class SimpleFlarumSearchTest extends TestCase
$this->prepDb();
$withResultSearch = json_encode($this->searchDiscussions('noResult:0', 5));
$this->assertContains('DISCUSSION 1', $withResultSearch);
$this->assertContains('DISCUSSION 2', $withResultSearch);
$this->assertStringContainsString('DISCUSSION 1', $withResultSearch);
$this->assertStringContainsString('DISCUSSION 2', $withResultSearch);
$this->assertEquals('[]', json_encode($this->searchDiscussions('noResult:1', 5)));
}

View File

@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">../src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Flarum Integration Tests">
<directory suffix="Test.php">./integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -1,25 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">../src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Flarum Unit Tests">
<directory suffix="Test.php">./unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
</listeners>
</phpunit>

View File

@@ -41,7 +41,7 @@ class WritablePathsTest extends TestCase
$problems = $writable->problems();
$this->assertCount(1, $problems);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
"%^The .+/tests/fixtures/writable_paths/missing directory doesn't exist$%",
$problems[0]['message']
);
@@ -59,7 +59,7 @@ class WritablePathsTest extends TestCase
$problems = $writable->problems();
$this->assertCount(1, $problems);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
"%^The .+/tests/fixtures/writable_paths/missing directory doesn't exist$%",
$problems[0]['message']
);

View File

@@ -56,7 +56,7 @@ class AvatarUploaderTest extends TestCase
}
$user->syncOriginal();
$this->assertEquals(null, $user->getOriginal('avatar_url'));
$this->assertEquals(null, $user->getRawOriginal('avatar_url'));
}
public function test_removing_url_avatar_removes_no_file()
@@ -76,7 +76,7 @@ class AvatarUploaderTest extends TestCase
}
$user->syncOriginal();
$this->assertEquals(null, $user->getOriginal('avatar_url'));
$this->assertEquals(null, $user->getRawOriginal('avatar_url'));
}
public function test_changing_avatar_removes_file()
@@ -97,6 +97,6 @@ class AvatarUploaderTest extends TestCase
}
$user->syncOriginal();
$this->assertNotEquals('ABCDEFGHabcdefgh.png', $user->getOriginal('avatar_url'));
$this->assertNotEquals('ABCDEFGHabcdefgh.png', $user->getRawOriginal('avatar_url'));
}
}