Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
madflow committed Feb 21, 2024
1 parent cca97ea commit f7ce796
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.4.33","version":"3.49.0","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"hashes":{"tests\/Cheesecake\/Test\/.conform.3125944.GeneratorTest.php":"7b0d47031f62c9d7d3fd1a92ab4c80f5","tests\/Cheesecake\/Test\/.conform.4858399.GeneratorTest.php":"5d8f1c8395752eea1d280250bee37216"}}
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"Cheesecake\\Test\\GeneratorTest::testHooks":6,"Cheesecake\\Test\\GeneratorTest::testRunOnTwig":4},"times":{"Cheesecake\\Test\\GeneratorTest::testInstance":0.002,"Cheesecake\\Test\\GeneratorTest::testRunMinimal":0.007,"Cheesecake\\Test\\GeneratorTest::testRunConstructorParams":0.003,"Cheesecake\\Test\\GeneratorTest::testRunMinimalNoOutput":0.004,"Cheesecake\\Test\\GeneratorTest::testFilters":0.001,"Cheesecake\\Test\\GeneratorTest::testRecursiveDirectories":0.003,"Cheesecake\\Test\\GeneratorTest::testHooks":0.003,"Cheesecake\\Test\\GeneratorTest::testRunOnTwig":0.002}}
33 changes: 11 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Cheesecake Test Suite">
<directory>./tests/Cheesecake/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/Cheesecake/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src/Cheesecake/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Cheesecake Test Suite">
<directory>./tests/Cheesecake/</directory>
</testsuite>
</testsuites>
</phpunit>
39 changes: 25 additions & 14 deletions tests/Cheesecake/Test/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function testRunConstructorParams()
$o = new Generator($template, ['app_name' => 'YO'], $options);
$o->run();

$this->assertEquals('# YO',
$this->assertEquals(
'# YO',
trim(file_get_contents($output.'/README.md'))
);

Expand All @@ -66,7 +67,8 @@ protected function assertMinimalCake($output)
$this->assertTrue(
is_file($output.'/README.md')
);
$this->assertEquals('# Cheesecake',
$this->assertEquals(
'# Cheesecake',
trim(file_get_contents($output.'/README.md'))
);

Expand All @@ -89,7 +91,8 @@ protected function assertMinimalCake($output)
);

$this->assertEquals(
'cheesecake', trim(file_get_contents($output.'/cheesecake/.env'))
'cheesecake',
trim(file_get_contents($output.'/cheesecake/.env'))
);
}

Expand All @@ -106,25 +109,32 @@ public function testFilters()

$json = json_decode(file_get_contents($output.'/FILTERS.json'));
$this->assertEquals(
$json->toLowerCase, 'hello good sir!'
$json->toLowerCase,
'hello good sir!'
);
$this->assertEquals(
$json->humanize, 'Hello Good Sir!'
$json->humanize,
'Hello Good Sir!'
);
$this->assertEquals(
$json->camelize, 'helloGoodSir'
$json->camelize,
'helloGoodSir'
);
$this->assertEquals(
$json->upperCamelize, 'HelloGoodSir'
$json->upperCamelize,
'HelloGoodSir'
);
$this->assertEquals(
$json->lowerCaseFirst, 'hello Good Sir!'
$json->lowerCaseFirst,
'hello Good Sir!'
);
$this->assertEquals(
$json->upperCaseFirst, 'Hello Good Sir!'
$json->upperCaseFirst,
'Hello Good Sir!'
);
$this->assertEquals(
$json->slugify, 'hello-good-sir'
$json->slugify,
'hello-good-sir'
);

$this->clean($output);
Expand Down Expand Up @@ -160,11 +170,12 @@ public function testHooks()
$this->assertTrue(
is_file($output.'/README.md')
);
$this->assertEquals('# Hello',
$this->assertEquals(
'# Hello',
trim(file_get_contents($output.'/README.md'))
);

$this->assertDirectoryNotExists($output . '/hooks');
$this->assertDirectoryDoesNotExist($output . '/hooks');

$this->clean($output);
}
Expand All @@ -179,8 +190,8 @@ public function testRunOnTwig()
$o->run();

$renderedTpl = \file_get_contents($output . '/test.html.twig');
$this->assertContains('<script src="{{asset(\'/dist/hello.min.js\') }}></script>', $renderedTpl );

$this->assertStringContainsString('<script src="{{asset(\'/dist/hello.min.js\') }}></script>', $renderedTpl);

$this->clean($output);
}
Expand Down

0 comments on commit f7ce796

Please sign in to comment.