Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3748275
D458.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D458.diff
View Options
diff --git a/tests/Providers/ProvidersFolderTest.php b/tests/Providers/ProvidersFolderTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Providers/ProvidersFolderTest.php
@@ -0,0 +1,25 @@
+<?php
+
+class ProvidersFolderTest extends TestCase {
+
+ public function testOmittedFiles () {
+ $providers = [];
+
+ $namespace = $this->app->getInstance()->getNamespace() . 'Providers\\';
+ $files = File::allFiles(app_path('Providers'));
+ foreach ($files as $file) {
+ $class = $namespace . $file->getBasename('.php');
+ $providers[] = $class;
+ }
+
+ $configuredProviders = Config::get('app.providers');
+
+ $this->assertArrayContainsArrayItems(
+ $providers,
+ $configuredProviders,
+ "Provider missing in config/app.php (at providers key)"
+ );
+
+ }
+
+}
diff --git a/tests/TestCase.php b/tests/TestCase.php
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -24,6 +24,41 @@
}
///
+ /// Custom assertions
+ ///
+
+ /**
+ * Asserts each value of an array are included in another array.
+ *
+ * @param array|Traversable $needles The values to search
+ * @param array|Traversable $haystack The array to check values exist
+ * @param string $message The test message
+ */
+ public static function assertArrayContainsArrayItems ($needles, $haystack, $message) {
+ self::assertThat(
+ self::arrayContainsArrayItems($needles, $haystack),
+ self::isTrue(),
+ $message
+ );
+ }
+
+ /**
+ * Checks if each value of an array are included in another array.
+ *
+ * @param array|Traversable $needles The values to search
+ * @param array|Traversable $haystack The array to check values exist
+ * @return bool true if each $needles value is found in $haystack; otherwise, false
+ */
+ public static function arrayContainsArrayItems ($needles, $haystack) {
+ foreach ($needles as $needle) {
+ if (!in_array($needle, $haystack)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ ///
/// Service providers
///
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 07:49 (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248918
Default Alt Text
D458.diff (2 KB)
Attached To
Mode
D458: Configuration test for providers
Attached
Detach File
Event Timeline
Log In to Comment