Skip to content

Commit

Permalink
ISSUE-337: phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tatevikg1 committed Dec 10, 2024
1 parent 43fb174 commit dbdc96d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 51 deletions.
44 changes: 24 additions & 20 deletions .github/workflows/core-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, dom, fileinfo, mysql
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
path: ${{ env.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install current dependencies from composer.lock
Expand All @@ -34,48 +32,54 @@ jobs:
run: phpDocumentor --version
- name: Generate documentation
run: composer run-php-documentor
- name: zip phpdocumentor dir
- name: Zip phpDocumentor directory
run: zip -r phpdocumentor.zip docs/phpdocumentor
- name: Upload generated doc files
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: doc-files
path: phpdocumentor.zip
deploy-docs:
name: Deploy Core Docs.
name: Deploy Core Docs
runs-on: ubuntu-20.04
needs: make-restapi-docs
steps:
- name: Checkout phplist/core-docs
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: phpList/core-docs
fetch-depth: 0
token: ${{ secrets.PUSH_CORE_DOCS }}
- name: Restore REST API Spec
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: doc-files
- name: unzip phpdocumentor
- name: Unzip phpDocumentor
run: |
unzip phpdocumentor.zip
rm phpdocumentor.zip
- name: List Files
run: ls
- name: Sync old files with newly generated ones.
- name: Sync old files with newly generated ones
run: rsync -av docs/phpdocumentor/* .
- name: Removed temp dirs
- name: Remove temporary directories
run: rm -rf docs
- name: Check if updates/changes.
- name: Check if updates/changes
run: git status --porcelain > repo-changes.txt
- name: Check changes file
run: cat repo-changes.txt
- name: Verify updates.
- name: Verify updates
id: allow-deploy
run: |
if [ -s repo-changes.txt ]; then echo "Updates made to documentation"; echo '::set-output name=DEPLOY::true'; else echo "No updates made to documentation deployment would be skipped."; echo '::set-output name=DEPLOY::false'; fi
- name: Commit changes and deply
if: ${{ steps.allow-deploy.outputs.DEPLOY == 'true' }}
if [ -s repo-changes.txt ]; then
echo "Updates made to documentation";
echo 'DEPLOY=true' >> $GITHUB_ENV;
else
echo "No updates made to documentation. Deployment would be skipped.";
echo 'DEPLOY=false' >> $GITHUB_ENV;
fi
- name: Commit changes and deploy
if: ${{ env.DEPLOY == 'true' }}
run: |
rm repo-changes.txt
git config user.name "github-actions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@ public function testFindReadsModelFromDatabase()
self::assertSame($category, $model->getCategory());
}

public function testCreatesOwnerAssociationAsProxy()
{
$this->loadFixtures([SubscriberListFixture::class, AdministratorFixture::class]);

$subscriberListId = 1;
$ownerId = 1;
/** @var SubscriberList $model */
$model = $this->subscriberListRepository->find($subscriberListId);
$owner = $model->getOwner();

self::assertInstanceOf(Administrator::class, $owner);
// self::assertInstanceOf(Proxy::class, $owner); todo: check proxy
self::assertSame($ownerId, $owner->getId());
}

public function testCreationDateOfNewModelIsSetToNowOnPersist()
{
$model = new SubscriberList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
use PhpList\Core\Tests\Integration\Domain\Repository\Fixtures\SubscriptionFixture;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

//use Doctrine\ORM\Proxy\Proxy;

/**
* Testcase.
*
Expand Down Expand Up @@ -70,20 +68,6 @@ public function testFindAllReadsModelsFromDatabase()
self::assertEquals($modificationDate, $model->getModificationDate());
}

public function testCreatesSubscriberAssociationAsProxy()
{
$this->loadFixtures([SubscriberFixture::class, SubscriberListFixture::class, SubscriptionFixture::class]);

$subscriberId = 1;
/** @var Subscription $model */
$model = $this->subscriptionRepository->findAll()[0];
$subscriber = $model->getSubscriber();

self::assertInstanceOf(Subscriber::class, $subscriber);
// self::assertInstanceOf(Proxy::class, $subscriber); // todo: check proxy
self::assertSame($subscriberId, $subscriber->getId());
}

public function testCreationDateOfNewModelIsSetToNowOnPersist()
{
$this->loadFixtures([SubscriberFixture::class, SubscriberListFixture::class]);
Expand Down

0 comments on commit dbdc96d

Please sign in to comment.