@@ -42,19 +42,8 @@ Write samples according to the [sample style guide](https://googlecloudplatform.
4242To run the tests in a samples directory, you will need to install
4343[ Composer] ( http://getcomposer.org/doc/00-intro.md ) .
4444
45- First install the testing dependencies which are shared across all samples:
46-
47- ```
48- composer install -d testing/
49- ```
50-
51- Next, install the dependencies for the individual sample you're testing:
52-
53- ```
54- SAMPLES_DIRECTORY=translate
55- cd $SAMPLES_DIRECTORY
56- composer install
57- ```
45+ First install dependencies as described in the
46+ [ README.md] ( google-analytics-data/README.md ) .
5847
5948### Environment variables
6049Some tests require specific environment variables to run. PHPUnit will skip the tests
@@ -64,27 +53,17 @@ to run against any sample project as follows:
6453
6554```
6655export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
67- export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET
56+ export GA_TEST_PROPERTY_ID=YOUR_GA4_PROPERTY_ID
6857```
6958
70- If you have access to the Google Cloud Kokoro project, decrypt the
71- ` .kokoro/secrets.sh.enc ` file and load those environment variables. Follow
72- the instructions in [ .kokoro/secrets-example.sh] ( .kokoro/secrets-example.sh ) .
73-
74- If your tests require new environment variables, you can set them up in
75- ` .kokoro/secrets.sh.enc ` so they pass on Kokoro. For instructions on managing those
76- variables, view [ .kokoro/secrets-example.sh] ( .kokoro/secrets-example.sh ) for more
77- information.
78-
7959### Run the tests
8060
8161Once the dependencies are installed and the environment variables set, you can run the
8262tests in a samples directory.
8363```
84- cd $SAMPLES_DIRECTORY
64+ cd google-analytics-data
8565# Execute the "phpunit" installed for the shared dependencies
86- PATH_TO_REPO=/path/to/php-docs-samples
87- $PATH_TO_REPO/testing/vendor/bin/phpunit
66+ ./vendor/bin/phpunit
8867```
8968
9069Use ` phpunit -v ` to get a more detailed output if there are errors.
@@ -102,18 +81,16 @@ recommendations. This is enforced using [PHP CS Fixer][php-cs-fixer], using the
10281Install that by running
10382
10483```
105- composer global require friendsofphp/php-cs-fixer
84+ RUN composer require --dev friendsofphp/php-cs-fixer
10685```
10786
10887Then to fix your directory or file run
10988
11089```
111- php-cs-fixer fix . --config .php-cs-fixer.dist.php
112- php-cs-fixer fix path/to/file --config .php-cs-fixer.dist.php
90+ ./vendor/bin/ php-cs-fixer fix --config .php-cs-fixer.dist.php .
91+ ./vendor/bin/ php-cs-fixer fix --config .php-cs-fixer.dist.php path/to/file
11392```
11493
115- The [ DLP snippets] ( https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/dlp ) are an example of snippets following the latest style guidelines.
116-
11794[ psr2 ] : http://www.php-fig.org/psr/psr-2/
11895[ psr4 ] : http://www.php-fig.org/psr/psr-4/
11996[ php-cs-fixer ] : https://github.com/FriendsOfPHP/PHP-CS-Fixer
0 commit comments