cameronterry / dark-matter

A highly opinionated domain mapping plugin for WordPress Networks
Other
12 stars 2 forks source link

Tweaked the get_domains_by_type() to return alphabetically #95

Closed cameronterry closed 2 years ago

cameronterry commented 2 years ago

This method was causing an "error" in the unit tests as the array mismatched the return.

Not really an "bug" per se, but the ordering of results from get_domains_by_type() was weird and making it return alphabetically - A to Z - makes more sense.

Resolves the following unit test error:

4) MediaDomainsTest::test_get_media_domains_manual
Media domains set by constant.
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => DM_Domain Object (
-        'id' => 18
+        'id' => 20
         'blog_id' => 17
         'is_primary' => false
-        'domain' => 'cdn1.mappeddomain1.test'
+        'domain' => 'cdn3.mappeddomain1.test'
         'active' => true
         'is_https' => true
         'type' => 2
@@ @@
     )
     1 => DM_Domain Object (...)
     2 => DM_Domain Object (
-        'id' => 20
+        'id' => 18
         'blog_id' => 17
         'is_primary' => false
-        'domain' => 'cdn3.mappeddomain1.test'
+        'domain' => 'cdn1.mappeddomain1.test'
         'active' => true
         'is_https' => true
         'type' => 2
     )
 )

/home/runner/work/dark-matter/dark-matter/tests/phpunit/domain-mapping/MediaDomainsTest.php:94