-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from hydephp/breaking-namespace-changes
Breaking namespace changes
- Loading branch information
Showing
13 changed files
with
137 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ions/FindsContentLengthForImageObject.php → ...tors/FindsContentLengthForImageObject.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
packages/framework/tests/Feature/Services/FileCacheServiceTest.php
This file was deleted.
Oops, something went wrong.
122 changes: 122 additions & 0 deletions
122
packages/framework/tests/Feature/Services/ViewDiffServiceTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Testing\Feature\Services; | ||
|
||
use Hyde\Framework\Hyde; | ||
use Hyde\Framework\Services\ViewDiffService; | ||
use Hyde\Testing\TestCase; | ||
|
||
/** | ||
* @covers \Hyde\Framework\Services\ViewDiffService | ||
*/ | ||
class ViewDiffServiceTest extends TestCase | ||
{ | ||
public function test_get_filecache() | ||
{ | ||
$fileCacheService = new ViewDiffService(); | ||
$fileCache = $fileCacheService->getFilecache(); | ||
|
||
$this->assertIsArray($fileCache); | ||
$this->assertArrayHasKey('/resources/views/layouts/app.blade.php', $fileCache); | ||
$this->assertArrayHasKey('unixsum', $fileCache['/resources/views/layouts/app.blade.php']); | ||
$this->assertEquals(32, strlen($fileCache['/resources/views/layouts/app.blade.php']['unixsum'])); | ||
} | ||
|
||
public function test_get_checksums() | ||
{ | ||
$fileCacheService = new ViewDiffService(); | ||
$checksums = $fileCacheService->getChecksums(); | ||
|
||
$this->assertIsArray($checksums); | ||
$this->assertEquals(32, strlen($checksums[0])); | ||
} | ||
|
||
public function test_checksum_matches_any() | ||
{ | ||
$fileCacheService = new ViewDiffService(); | ||
|
||
$this->assertTrue($fileCacheService->checksumMatchesAny(ViewDiffService::unixsumFile( | ||
Hyde::vendorPath('resources/views/layouts/app.blade.php')) | ||
)); | ||
} | ||
|
||
public function test_checksum_matches_any_false() | ||
{ | ||
$fileCacheService = new ViewDiffService(); | ||
|
||
$this->assertFalse($fileCacheService->checksumMatchesAny(ViewDiffService::unixsum( | ||
'foo' | ||
))); | ||
} | ||
|
||
public function test_method_returns_string() | ||
{ | ||
$this->assertIsString(ViewDiffService::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_string_with_length_of_32() | ||
{ | ||
$this->assertEquals(32, strlen(ViewDiffService::unixsum('foo'))); | ||
} | ||
|
||
public function test_method_returns_string_matching_expected_format() | ||
{ | ||
$this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', ViewDiffService::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_same_value_for_same_string_using_normal_method() | ||
{ | ||
$this->assertEquals(md5('foo'), ViewDiffService::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_different_value_for_different_string() | ||
{ | ||
$this->assertNotEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('bar')); | ||
} | ||
|
||
public function test_function_is_case_sensitive() | ||
{ | ||
$this->assertNotEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('FOO')); | ||
} | ||
|
||
public function test_function_is_space_sensitive() | ||
{ | ||
$this->assertNotEquals(ViewDiffService::unixsum(' foo '), ViewDiffService::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_same_value_regardless_of_end_of_line_sequence() | ||
{ | ||
$this->assertEquals(ViewDiffService::unixsum('foo'), ViewDiffService::unixsum('foo')); | ||
$this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\n")); | ||
$this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\r")); | ||
$this->assertEquals(ViewDiffService::unixsum("foo\n"), ViewDiffService::unixsum("foo\r\n")); | ||
} | ||
|
||
public function test_method_returns_same_value_for_string_with_mixed_end_of_line_sequences() | ||
{ | ||
$this->assertEquals(ViewDiffService::unixsum("foo\nbar\r\nbaz\r\n"), | ||
ViewDiffService::unixsum("foo\nbar\nbaz\n")); | ||
} | ||
|
||
public function test_method_returns_same_value_when_loaded_from_file() | ||
{ | ||
$string = "foo\nbar\r\nbaz\r\n"; | ||
$file = tempnam(sys_get_temp_dir(), 'foo'); | ||
file_put_contents($file, $string); | ||
|
||
$this->assertEquals(ViewDiffService::unixsum($string), ViewDiffService::unixsum(file_get_contents($file))); | ||
|
||
unlink($file); | ||
} | ||
|
||
public function test_method_returns_same_value_when_loaded_from_file_using_shorthand() | ||
{ | ||
$string = "foo\nbar\r\nbaz\r\n"; | ||
$file = tempnam(sys_get_temp_dir(), 'foo'); | ||
file_put_contents($file, $string); | ||
|
||
$this->assertEquals(ViewDiffService::unixsum($string), ViewDiffService::unixsumFile($file)); | ||
|
||
unlink($file); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
packages/framework/tests/Unit/FileCacheServiceUnixsumMethodTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,3 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Testing\Unit; | ||
|
||
use Hyde\Framework\Services\FileCacheService as Service; | ||
use Hyde\Testing\TestCase; | ||
|
||
class FileCacheServiceUnixsumMethodTest extends TestCase | ||
{ | ||
public function test_method_returns_string() | ||
{ | ||
$this->assertIsString(Service::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_string_with_length_of_32() | ||
{ | ||
$this->assertEquals(32, strlen(Service::unixsum('foo'))); | ||
} | ||
|
||
public function test_method_returns_string_matching_expected_format() | ||
{ | ||
$this->assertMatchesRegularExpression('/^[a-f0-9]{32}$/', Service::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_same_value_for_same_string_using_normal_method() | ||
{ | ||
$this->assertEquals(md5('foo'), Service::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_different_value_for_different_string() | ||
{ | ||
$this->assertNotEquals(Service::unixsum('foo'), Service::unixsum('bar')); | ||
} | ||
|
||
public function test_function_is_case_sensitive() | ||
{ | ||
$this->assertNotEquals(Service::unixsum('foo'), Service::unixsum('FOO')); | ||
} | ||
|
||
public function test_function_is_space_sensitive() | ||
{ | ||
$this->assertNotEquals(Service::unixsum(' foo '), Service::unixsum('foo')); | ||
} | ||
|
||
public function test_method_returns_same_value_regardless_of_end_of_line_sequence() | ||
{ | ||
$this->assertEquals(Service::unixsum('foo'), Service::unixsum('foo')); | ||
$this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\n")); | ||
$this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\r")); | ||
$this->assertEquals(Service::unixsum("foo\n"), Service::unixsum("foo\r\n")); | ||
} | ||
|
||
public function test_method_returns_same_value_for_string_with_mixed_end_of_line_sequences() | ||
{ | ||
$this->assertEquals(Service::unixsum("foo\nbar\r\nbaz\r\n"), | ||
Service::unixsum("foo\nbar\nbaz\n")); | ||
} | ||
|
||
public function test_method_returns_same_value_when_loaded_from_file() | ||
{ | ||
$string = "foo\nbar\r\nbaz\r\n"; | ||
$file = tempnam(sys_get_temp_dir(), 'foo'); | ||
file_put_contents($file, $string); | ||
|
||
$this->assertEquals(Service::unixsum($string), Service::unixsum(file_get_contents($file))); | ||
|
||
unlink($file); | ||
} | ||
|
||
public function test_method_returns_same_value_when_loaded_from_file_using_shorthand() | ||
{ | ||
$string = "foo\nbar\r\nbaz\r\n"; | ||
$file = tempnam(sys_get_temp_dir(), 'foo'); | ||
file_put_contents($file, $string); | ||
|
||
$this->assertEquals(Service::unixsum($string), Service::unixsumFile($file)); | ||
|
||
unlink($file); | ||
} | ||
} |